[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250221030755.219277-1-wdhh66@163.com>
Date: Fri, 21 Feb 2025 11:07:55 +0800
From: Chaohai Chen <wdhh66@....com>
To: James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
bvanassche@....org,
Chaohai Chen <wdhh66@....com>
Subject: [PATCH v2] scsi: fix missing lock protection
async_scan_lock is designed to protect the scanning_hosts list,
but there is no protection here.
Signed-off-by: Chaohai Chen <wdhh66@....com>
---
drivers/scsi/scsi_scan.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 96d7e1a9a7c7..4833b8fe251b 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -151,8 +151,9 @@ int scsi_complete_async_scans(void)
struct async_scan_data *data;
do {
- if (list_empty(&scanning_hosts))
- return 0;
+ scoped_guard(spinlock, &async_scan_lock)
+ if (list_empty(&scanning_hosts))
+ return 0;
/* If we can't get memory immediately, that's OK. Just
* sleep a little. Even if we never get memory, the async
* scans will finish eventually.
--
2.34.1
Powered by blists - more mailing lists