Skip to content

Commit 76e43fa

Browse files
Fenghua Yuvinodkoul
authored andcommitted
dmaengine: idxd: Avoid unnecessary destruction of file_ida
file_ida is allocated during cdev open and is freed accordingly during cdev release. This sequence is guaranteed by driver file operations. Therefore, there is no need to destroy an already empty file_ida when the WQ cdev is removed. Worse, ida_free() in cdev release may happen after destruction of file_ida per WQ cdev. This can lead to accessing an id in file_ida after it has been destroyed, resulting in a kernel panic. Remove ida_destroy(&file_ida) to address these issues. Fixes: e6fd6d7 ("dmaengine: idxd: add a device to represent the file opened") Signed-off-by: Lijun Pan <[email protected]> Signed-off-by: Fenghua Yu <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 700b2e1 commit 76e43fa

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
@@ -501,7 +501,6 @@ void idxd_wq_del_cdev(struct idxd_wq *wq)
501501
struct idxd_cdev *idxd_cdev;
502502

503503
idxd_cdev = wq->idxd_cdev;
504-
ida_destroy(&file_ida);
505504
wq->idxd_cdev = NULL;
506505
cdev_device_del(&idxd_cdev->cdev, cdev_dev(idxd_cdev));
507506
put_device(cdev_dev(idxd_cdev));

0 commit comments

Comments
 (0)