[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220401142536.1948161-49-sashal@kernel.org>
Date: Fri, 1 Apr 2022 10:23:56 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Don Brace <don.brace@...rochip.com>,
Scott Benesh <scott.benesh@...rochip.com>,
Scott Teel <scott.teel@...rochip.com>,
Kevin Barnett <kevin.barnett@...rochip.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Sasha Levin <sashal@...nel.org>, jejb@...ux.ibm.com,
storagedev@...rochip.com, linux-scsi@...r.kernel.org
Subject: [PATCH AUTOSEL 5.17 049/149] scsi: smartpqi: Fix rmmod stack trace
From: Don Brace <don.brace@...rochip.com>
[ Upstream commit c4ff687d25c05919382a759503bd3821689f4e2f ]
Prevent "BUG: scheduling while atomic: rmmod" stack trace.
Stop setting spin_locks before calling OS functions to remove devices.
Link: https://lore.kernel.org/r/164375207296.440833.4996145011193819683.stgit@brunhilda.pdev.net
Reviewed-by: Scott Benesh <scott.benesh@...rochip.com>
Reviewed-by: Scott Teel <scott.teel@...rochip.com>
Reviewed-by: Kevin Barnett <kevin.barnett@...rochip.com>
Signed-off-by: Don Brace <don.brace@...rochip.com>
Signed-off-by: Martin K. Petersen <martin.petersen@...cle.com>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/scsi/smartpqi/smartpqi_init.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c
index f0897d587454..2db9f874cc51 100644
--- a/drivers/scsi/smartpqi/smartpqi_init.c
+++ b/drivers/scsi/smartpqi/smartpqi_init.c
@@ -2513,17 +2513,15 @@ static void pqi_remove_all_scsi_devices(struct pqi_ctrl_info *ctrl_info)
struct pqi_scsi_dev *device;
struct pqi_scsi_dev *next;
- spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
-
list_for_each_entry_safe(device, next, &ctrl_info->scsi_device_list,
scsi_device_list_entry) {
if (pqi_is_device_added(device))
pqi_remove_device(ctrl_info, device);
+ spin_lock_irqsave(&ctrl_info->scsi_device_list_lock, flags);
list_del(&device->scsi_device_list_entry);
pqi_free_device(device);
+ spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
}
-
- spin_unlock_irqrestore(&ctrl_info->scsi_device_list_lock, flags);
}
static int pqi_scan_scsi_devices(struct pqi_ctrl_info *ctrl_info)
--
2.34.1
Powered by blists - more mailing lists