Re: [PATCH] scsi: pm8001: Fix data race in sysfs SAS address read

From: Chengfeng Ye

Date: Thu Jan 15 2026 - 12:57:30 EST


Hi Bart,

Thanks for looking into this.

> Why isn't READ_ONCE() sufficient?
READ_ONCE() does not suffice because the write path still uses
memcpy(), which is not atomic.
So it is possible that when READ_ONCE() executes and reads all the 8
bytes at once, the SAS
address is still partially updated by the ISR.

> And why explicit spin_lock_irqsave()
> and spin_unlock_irqrestore() calls instead of using scoped_guard()?
Thanks for the notice. I just sent a v2 patch to address it.

Best,
Chengfeng