lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250219081119.203295-1-wdhh66@163.com>
Date: Wed, 19 Feb 2025 16:11:19 +0800
From: Chaohai Chen <wdhh66@....com>
To: martin.petersen@...cle.com
Cc: James.Bottomley@...senPartnership.com,
	linux-scsi@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Chaohai Chen <wdhh66@....com>
Subject: [PATCH] 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 087fcbfc9aaa..9a90e6ba5603 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -151,8 +151,12 @@ int scsi_complete_async_scans(void)
 	struct async_scan_data *data;
 
 	do {
-		if (list_empty(&scanning_hosts))
+		spin_lock(&async_scan_lock);
+		if (list_empty(&scanning_hosts)) {
+			spin_unlock(&async_scan_lock);
 			return 0;
+		}
+		spin_unlock(&async_scan_lock);
 		/* 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

Powered by Openwall GNU/*/Linux Powered by OpenVZ