Commit 1a5c5a2
scsi: smartpqi: Fix device resources accessed after device removal
[ Upstream commit b518e86 ]
Correct possible race conditions during device removal.
Previously, a scheduled work item to reset a LUN could still execute
after the device was removed, leading to use-after-free and other
resource access issues.
This race condition occurs because the abort handler may schedule a LUN
reset concurrently with device removal via sdev_destroy(), leading to
use-after-free and improper access to freed resources.
- Check in the device reset handler if the device is still present in
the controller's SCSI device list before running; if not, the reset
is skipped.
- Cancel any pending TMF work that has not started in sdev_destroy().
- Ensure device freeing in sdev_destroy() is done while holding the
LUN reset mutex to avoid races with ongoing resets.
Fixes: 2d80f40 ("scsi: smartpqi: Update deleting a LUN via sysfs")
Reviewed-by: Scott Teel <scott.teel@microchip.com>
Reviewed-by: Scott Benesh <scott.benesh@microchip.com>
Signed-off-by: Mike McGowen <mike.mcgowen@microchip.com>
Signed-off-by: Don Brace <don.brace@microchip.com>
Link: https://patch.msgid.link/20251106163823.786828-3-don.brace@microchip.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent f7c6c26 commit 1a5c5a2
1 file changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6410 | 6410 | | |
6411 | 6411 | | |
6412 | 6412 | | |
| 6413 | + | |
6413 | 6414 | | |
6414 | 6415 | | |
6415 | 6416 | | |
6416 | 6417 | | |
| 6418 | + | |
| 6419 | + | |
| 6420 | + | |
| 6421 | + | |
| 6422 | + | |
| 6423 | + | |
| 6424 | + | |
| 6425 | + | |
| 6426 | + | |
| 6427 | + | |
| 6428 | + | |
6417 | 6429 | | |
6418 | 6430 | | |
6419 | 6431 | | |
| |||
6594 | 6606 | | |
6595 | 6607 | | |
6596 | 6608 | | |
| 6609 | + | |
6597 | 6610 | | |
| 6611 | + | |
6598 | 6612 | | |
6599 | 6613 | | |
6600 | 6614 | | |
| |||
6621 | 6635 | | |
6622 | 6636 | | |
6623 | 6637 | | |
| 6638 | + | |
| 6639 | + | |
| 6640 | + | |
| 6641 | + | |
6624 | 6642 | | |
6625 | 6643 | | |
| 6644 | + | |
6626 | 6645 | | |
6627 | 6646 | | |
6628 | 6647 | | |
| |||
0 commit comments