Skip to content

Commit 0642287

Browse files
harshimogalapallivinodkoul
authored andcommitted
dmaengine: idxd: Fix passing freed memory in idxd_cdev_open()
Smatch warns: drivers/dma/idxd/cdev.c:327: idxd_cdev_open() warn: 'sva' was already freed. When idxd_wq_set_pasid() fails, the current code unbinds sva and then goes to 'failed_set_pasid' where iommu_sva_unbind_device is called again causing the above warning. [ device_user_pasid_enabled(idxd) is still true when calling failed_set_pasid ] Fix this by removing additional unbind when idxd_wq_set_pasid() fails Fixes: b022f59 ("dmaengine: idxd: add idxd_copy_cr() to copy user completion record during page fault handling") Signed-off-by: Harshit Mogalapalli <[email protected]> Acked-by: Fenghua Yu <[email protected]> Acked-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent ac9a786 commit 0642287

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

drivers/dma/idxd/cdev.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ static int idxd_cdev_open(struct inode *inode, struct file *filp)
277277
if (wq_dedicated(wq)) {
278278
rc = idxd_wq_set_pasid(wq, pasid);
279279
if (rc < 0) {
280-
iommu_sva_unbind_device(sva);
281280
dev_err(dev, "wq set pasid failed: %d\n", rc);
282281
goto failed_set_pasid;
283282
}

0 commit comments

Comments
 (0)