Re: [BUG] usb: cdc-wdm: Missing barriers in ad-hoc lockless buffer
From: Oliver Neukum
Date: Thu Mar 05 2026 - 08:02:26 EST
On 05.03.26 13:28, Gui-Dong Han wrote:
Specifically, wdm_read() accesses ->length and then ->flags, often
without holding ->iuspin. Similarly, wdm_in_callback() involves
multiple accesses to both.
I am indeed nervous about this pattern. Without barriers, changes to
these associated fields made on one CPU might be observed in a
completely different order on another CPU.
OK, I rechecked. And indeed it seems to me like setting WDM_OVERFLOW
and WDM_READ could be reordered with respect to each other in
wdm_in_callback() and that must not happen.
What do you think?
Regards
Oliver