Re: [PATCH v4] scsi: core: Fix async_scan race condition with READ_ONCE/WRITE_ONCE
From: Bart Van Assche
Date: Wed Mar 04 2026 - 09:28:04 EST
On 3/4/26 3:29 AM, Chaohai Chen wrote:
- if (!shost->async_scan) {
+ if (!READ_ONCE(shost->async_scan)) {
Yikes. I'm not aware of any other kernel code that uses READ_ONCE() /
WRITE_ONCE() to access a member variable protected by a mutex. Please
annotate the async_scan member variable with __guarded_by() and drop the
READ_ONCE() and WRITE_ONCE() invocations introduced by this patch.
Bart.