RE: [PATCH rtw-next] wifi: rtl8xxxu: isolate the USB register buffer from CPU state
From: Ping-Ke Shih
Date: Mon Oct 12 2026 - 01:44:39 EST
Kim Wooseok via B4 Relay <devnull+5mghybrid.khu.ac.kr@xxxxxxxxxx> wrote:
> From: Kim Wooseok <5mghybrid@xxxxxxxxx>
>
> An RTL8192EU failed to reconnect on a Raspberry Pi after an AP power
> cycle. RF_MODE contained a corrupted value, and restoring its initialized
> value restored reception.
>
> The register access helpers pass usb_buf directly to usb_control_msg(),
> but the buffer is embedded next to usb_buf_mutex. On the affected Pi,
> it shares a cache line with the mutex's waiter state. A contending task
> updates that state while the USB transfer uses the buffer. This violates
> the cache-line isolation required for non-coherent DMA.
Cool. How did you dig that?
>
> Allocate the buffer once in probe and reuse it, avoiding an allocation
> for every register access. Keep the existing register access helpers and
> mutex protection. Free the buffer on probe failure and after power_off()
> in disconnect, since shutdown still uses the register access helpers.
>
> Fixes: 26f1fad29ad9 ("New driver: rtl8xxxu (mac80211)")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Kim Wooseok <5mghybrid@xxxxxxxxx>
Acked-by: Ping-Ke Shih <pkshih@xxxxxxxxxxx>