diff mbox series

scsi: fix schedule_work in spin_lock_irqsave in sdev_evt_send

Message ID 20250226033802.233509-1-wdhh6@aliyun.com (mailing list archive)
State New
Headers show
Series scsi: fix schedule_work in spin_lock_irqsave in sdev_evt_send | expand

Commit Message

Chaohai Chen Feb. 26, 2025, 3:38 a.m. UTC
sdev->list_lock is designed to protect the sdev->event_list, the action
should be single(add, delete, traverse) in the lock.

Signed-off-by: Chaohai Chen <wdhh6@aliyun.com>
---
 drivers/scsi/scsi_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index be0890e4e706..ca1bbd5e38c0 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2661,8 +2661,8 @@  void sdev_evt_send(struct scsi_device *sdev, struct scsi_event *evt)
 
 	spin_lock_irqsave(&sdev->list_lock, flags);
 	list_add_tail(&evt->node, &sdev->event_list);
-	schedule_work(&sdev->event_work);
 	spin_unlock_irqrestore(&sdev->list_lock, flags);
+	schedule_work(&sdev->event_work);
 }
 EXPORT_SYMBOL_GPL(sdev_evt_send);