Re: [PATCH] usb: gadget: dummy_hcd: prevent fifo_req reuse during giveback
From: Jinchao Wang
Date: Thu Jul 16 2026 - 22:48:26 EST
On 7/16/2026 10:40 PM, Alan Stern wrote:
> On Wed, Jul 15, 2026 at 01:34:13AM -0400, Jinchao Wang wrote:
>>> Wow! I'm impressed. How did you figure this out?
>>
>> With a hardware watchpoint: I armed one on the victim field
>> (req->complete, at arg2+56 of usb_gadget_giveback_request) only while
>> usb_gadget_giveback_request() was running, and it caught the writing
>> memcpy with a full stack - usb_ep_queue <- raw_process_ep_io <-
>> raw_ioctl - on the same request that crashed an instant later.
>>
>> The watchpoint setup came from a small tool I am working on; I posted
>> it as an RFC in case it is useful to others:
>>
>> https://lore.kernel.org/all/20260714182243.10687-1-wangjinchao600@xxxxxxxxx/
>
> That tool looks really nice. I'm glad to see hardware breakpoints
> becoming easier to use, because I wrote a large part of the initial
> implementation -- see for example commit 0067f1297241 ("hw-breakpoints:
> x86 architecture implementation of Hardware Breakpoint interfaces").
>
> Alan Stern
Thank you! KWatch builds directly on that work - the perf hw_breakpoint
layer does all the heavy lifting, and KWatch only adds a small
"reinstall" operation on top, plus the windowing logic around it.
I am preparing a v2 of the RFC based on the review so far; if you don't
mind, I will Cc you on it.
Thanks,
Jinchao