Skip to content

Commit ed3e484

Browse files
Chaohai Chenmartinkpetersen
authored andcommitted
scsi: core: 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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent ac0fb4a commit ed3e484

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/scsi/scsi_scan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ int scsi_complete_async_scans(void)
151151
struct async_scan_data *data;
152152

153153
do {
154-
if (list_empty(&scanning_hosts))
155-
return 0;
154+
scoped_guard(spinlock, &async_scan_lock)
155+
if (list_empty(&scanning_hosts))
156+
return 0;
156157
/* If we can't get memory immediately, that's OK. Just
157158
* sleep a little. Even if we never get memory, the async
158159
* scans will finish eventually.

0 commit comments

Comments
 (0)