[PATCH v2 17/17] mpi3mr: Fix NULL pointer dereference on PCI error recovery
Chandrakanth Patil <[email protected]>
| Newsgroups | org.kernel.vger.linux-scsi |
|---|---|
| Message-ID | <[email protected]> |
On a frozen PCI channel the driver unmaps the register window and frees
the interrupts, but leaves the firmware event workqueue running. An
event handler that is already in flight can still reach the register
window after it has been unmapped.
Stop event processing and drain the queue first, and start it again
when the channel resumes.
Fixes: 30bafe1774f0 ("scsi: mpi3mr: Support PCI Error Recovery callback handlers")
Signed-off-by: Chandrakanth Patil <[email protected]>
---
v2:
- Removed stop_drv_processing and mpi3mr_cleanup_fwevt_list() calls from
pci_channel_io_frozen to avoid workqueue cancellation deadlocks and
preserve transparent I/O recovery (SCSI_MLQUEUE_HOST_BUSY).
- Added pci_err_recovery check in mpi3mr_fwevt_bh() to safely skip bottom-half
event handling during PCI error recovery.
drivers/scsi/mpi3mr/mpi3mr_os.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c
index e97e343b14fa..a389f7f2c741 100644
--- a/drivers/scsi/mpi3mr/mpi3mr_os.c
+++ b/drivers/scsi/mpi3mr/mpi3mr_os.c
@@ -2130,9 +2130,11 @@ static void mpi3mr_fwevt_bh(struct mpi3mr_ioc *mrioc,
mpi3mr_fwevt_del_from_list(mrioc, fwevt);
mrioc->current_event = fwevt;
- if (mrioc->stop_drv_processing) {
- dprint_event_bh(mrioc, "ignoring event(0x%02x) in the bottom half handler\n"
- "due to stop_drv_processing\n", fwevt->event_id);
+ if (mrioc->stop_drv_processing || mrioc->pci_err_recovery) {
+ dprint_event_bh(mrioc,
+ "ignoring event(0x%02x) in the bottom half handler\n"
+ "due to stop_drv_processing or pci_err_recovery\n",
+ fwevt->event_id);
goto out;
}
--
2.52.0