Re: [PATCH rtw-next] wifi: rtl8xxxu: isolate the USB register buffer from CPU state

From: Kim Wooseok

Date: Fri Oct 16 2026 - 14:18:06 EST


Hi Bitterblue,

> Perhaps it's a silly question, but doesn't this just move the problem
> elsewhere? Or does kmalloc_obj() guarantee that nothing else will access
> the memory near usb_buf?

With a separately allocated kmalloc buffer, the kernel ensures that
CPU accesses to other objects do not corrupt the DMA data through
cache-line sharing. It provides the required alignment or bounce
buffering, and usb_control_msg() uses this DMA mapping path.

The patch turns usb_buf from an embedded member into a standalone
kmalloc buffer so that this guarantee applies to the buffer itself.

> An allocation for every register access was not happening even before
> this patch. I guess your LLM wrote this...

I did not state that the previous code allocated a buffer on every
register access. That sentence describes the allocation strategy for
the newly separate buffer: allocate it once in probe and reuse it.

If any part of the explanation is unclear, please point it out and I
will clarify it. I don't think speculation about how the text was
written is necessary.

Wooseok