Re: [PATCH] usb: gadget: dummy_hcd: prevent fifo_req reuse during giveback
From: Alan Stern
Date: Thu Jul 16 2026 - 22:40:27 EST
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