Skip to content

Commit f6ab594

Browse files
avasummermartinkpetersen
authored andcommitted
scsi: aic94xx: fix use-after-free in device removal path
The asd_pci_remove() function fails to synchronize with pending tasklets before freeing the asd_ha structure, leading to a potential use-after-free vulnerability. When a device removal is triggered (via hot-unplug or module unload), race condition can occur. The fix adds tasklet_kill() before freeing the asd_ha structure, ensuring all scheduled tasklets complete before cleanup proceeds. Reported-by: Yuhao Jiang <danisjiang@gmail.com> Reported-by: Junrui Luo <moonafterrain@outlook.com> Fixes: 2908d77 ("[SCSI] aic94xx: new driver") Cc: stable@vger.kernel.org Signed-off-by: Junrui Luo <moonafterrain@outlook.com> Link: https://patch.msgid.link/ME2PR01MB3156AB7DCACA206C845FC7E8AFFDA@ME2PR01MB3156.ausprd01.prod.outlook.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent d204087 commit f6ab594

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/scsi/aic94xx/aic94xx_init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,9 @@ static void asd_pci_remove(struct pci_dev *dev)
882882

883883
asd_disable_ints(asd_ha);
884884

885+
/* Ensure all scheduled tasklets complete before freeing resources */
886+
tasklet_kill(&asd_ha->seq.dl_tasklet);
887+
885888
asd_remove_dev_attrs(asd_ha);
886889

887890
/* XXX more here as needed */

0 commit comments

Comments
 (0)