Skip to content

Commit 778dfac

Browse files
mapicccyvinodkoul
authored andcommitted
dmaengine: idxd: Protect int_handle field in hw descriptor
The int_handle field in hw descriptor should also be protected by wmb() before possibly triggering a DMA read. Fixes: eb0cf33 (dmaengine: idxd: move interrupt handle assignment) Signed-off-by: Guanjun <guanjun@linux.alibaba.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Fenghua Yu <fenghua.yu@intel.com> Reviewed-by: Lijun Pan <lijun.pan@intel.com> Link: https://lore.kernel.org/r/20231211053704.2725417-2-guanjun@linux.alibaba.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 54bed6b commit 778dfac

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/dma/idxd/submit.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,6 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
182182

183183
portal = idxd_wq_portal_addr(wq);
184184

185-
/*
186-
* The wmb() flushes writes to coherent DMA data before
187-
* possibly triggering a DMA read. The wmb() is necessary
188-
* even on UP because the recipient is a device.
189-
*/
190-
wmb();
191-
192185
/*
193186
* Pending the descriptor to the lockless list for the irq_entry
194187
* that we designated the descriptor to.
@@ -199,6 +192,13 @@ int idxd_submit_desc(struct idxd_wq *wq, struct idxd_desc *desc)
199192
llist_add(&desc->llnode, &ie->pending_llist);
200193
}
201194

195+
/*
196+
* The wmb() flushes writes to coherent DMA data before
197+
* possibly triggering a DMA read. The wmb() is necessary
198+
* even on UP because the recipient is a device.
199+
*/
200+
wmb();
201+
202202
if (wq_dedicated(wq)) {
203203
iosubmit_cmds512(portal, desc->hw, 1);
204204
} else {

0 commit comments

Comments
 (0)