* [PATCH v2] scsi: fix missing lock protection
@ 2025-02-21 3:07 Chaohai Chen
2025-02-25 20:55 ` Bart Van Assche
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chaohai Chen @ 2025-02-21 3:07 UTC (permalink / raw)
To: James.Bottomley, martin.petersen
Cc: linux-scsi, linux-kernel, bvanassche, Chaohai Chen
async_scan_lock is designed to protect the scanning_hosts list,
but there is no protection here.
Signed-off-by: Chaohai Chen <wdhh66@163.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
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] scsi: fix missing lock protection
2025-02-21 3:07 [PATCH v2] scsi: fix missing lock protection Chaohai Chen
@ 2025-02-25 20:55 ` Bart Van Assche
2025-03-04 2:00 ` Martin K. Petersen
2025-03-11 1:19 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2025-02-25 20:55 UTC (permalink / raw)
To: Chaohai Chen, James.Bottomley, martin.petersen; +Cc: linux-scsi, linux-kernel
On 2/20/25 7:07 PM, Chaohai Chen wrote:
> async_scan_lock is designed to protect the scanning_hosts list,
> but there is no protection here.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scsi: fix missing lock protection
2025-02-21 3:07 [PATCH v2] scsi: fix missing lock protection Chaohai Chen
2025-02-25 20:55 ` Bart Van Assche
@ 2025-03-04 2:00 ` Martin K. Petersen
2025-03-11 1:19 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-04 2:00 UTC (permalink / raw)
To: Chaohai Chen
Cc: James.Bottomley, martin.petersen, linux-scsi, linux-kernel,
bvanassche
Chaohai,
> async_scan_lock is designed to protect the scanning_hosts list,
> but there is no protection here.
Applied to 6.15/scsi-staging, thanks!
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scsi: fix missing lock protection
2025-02-21 3:07 [PATCH v2] scsi: fix missing lock protection Chaohai Chen
2025-02-25 20:55 ` Bart Van Assche
2025-03-04 2:00 ` Martin K. Petersen
@ 2025-03-11 1:19 ` Martin K. Petersen
2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2025-03-11 1:19 UTC (permalink / raw)
To: James.Bottomley, Chaohai Chen
Cc: Martin K . Petersen, linux-scsi, linux-kernel, bvanassche
On Fri, 21 Feb 2025 11:07:55 +0800, Chaohai Chen wrote:
> async_scan_lock is designed to protect the scanning_hosts list,
> but there is no protection here.
>
>
Applied to 6.15/scsi-queue, thanks!
[1/1] scsi: fix missing lock protection
https://git.kernel.org/mkp/scsi/c/ed3e4842224f
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-11 1:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-21 3:07 [PATCH v2] scsi: fix missing lock protection Chaohai Chen
2025-02-25 20:55 ` Bart Van Assche
2025-03-04 2:00 ` Martin K. Petersen
2025-03-11 1:19 ` Martin K. Petersen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox