Commit 7cab853
committed
scsi: smartpqi: Fix device resources accessed after device removal
JIRA: https://issues.redhat.com/browse/RHEL-107917
commit b518e86
Author: Mike McGowen <mike.mcgowen@microchip.com>
Date: Thu Nov 6 10:38:20 2025 -0600
scsi: smartpqi: Fix device resources accessed after device removal
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>
(cherry picked from commit b518e86)
Assisted-by: Patchpal
Signed-off-by: Don Brace <dbrace@redhat.com>1 parent 1c7cc1c commit 7cab853
1 file changed
+19
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6426 | 6426 | | |
6427 | 6427 | | |
6428 | 6428 | | |
| 6429 | + | |
6429 | 6430 | | |
6430 | 6431 | | |
6431 | 6432 | | |
6432 | 6433 | | |
| 6434 | + | |
| 6435 | + | |
| 6436 | + | |
| 6437 | + | |
| 6438 | + | |
| 6439 | + | |
| 6440 | + | |
| 6441 | + | |
| 6442 | + | |
| 6443 | + | |
| 6444 | + | |
6433 | 6445 | | |
6434 | 6446 | | |
6435 | 6447 | | |
| |||
6609 | 6621 | | |
6610 | 6622 | | |
6611 | 6623 | | |
| 6624 | + | |
6612 | 6625 | | |
| 6626 | + | |
6613 | 6627 | | |
6614 | 6628 | | |
6615 | 6629 | | |
| |||
6636 | 6650 | | |
6637 | 6651 | | |
6638 | 6652 | | |
| 6653 | + | |
| 6654 | + | |
| 6655 | + | |
| 6656 | + | |
6639 | 6657 | | |
6640 | 6658 | | |
| 6659 | + | |
6641 | 6660 | | |
6642 | 6661 | | |
6643 | 6662 | | |
| |||
0 commit comments