Re: [PATCH v3] usb: core: hcd: flush giveback work on stop

From: Alan Stern

Date: Thu Oct 29 2026 - 10:30:15 EST


On Thu, Oct 29, 2026 at 11:44:22AM +0100, Michal Pecio wrote:
> On Thu, 29 Oct 2026 10:42:35 +0100, Greg Kroah-Hartman wrote:
> > On Sun, Oct 25, 2026 at 10:54:57AM +0300, IgorpetinDev wrote:
> > > Hi Michal,
> > >
> > > > No such domain?
> > > > Looks like you trusted an LLM ;)
> > >
> > > good catch, that was just a clumsy typo on my part: I accidentally typed
> > > appspotmail.com instead of appspot.com in the closes tag, anyway - the syzbot ID
> > > itself is valid. If Greg or Alan prefer a v4 to fix the URL typo, I'll
> > > gladly resend it, or it can be fixed up when applying.
> >
> > Please fix up and send a new version.
> >
> > thanks,
> >
> > greg k-h
>
> Hi Greg,
>
> This race had been reported by syzbot previously and a patch
> has been hanging on linux-usb since August.
>
> https://lore.kernel.org/linux-usb/20260823125831.6ea35650.michal.pecio@xxxxxxxxx/
>
> There is only a bit of controversy over flushing vs cancelling the
> work. I think that cancelling (and leaking stray completions as opposed
> to letting them run, likely UAF things and maybe corrupt memory) is the
> right choice, as a courtesy to anyone who might create such bugs and
> need to deal with them.

I have to agree that Michal's patch is more elegant than Igor's.

(Although, as a small nit, I would change the last line of the new
comment from:

* However, we still must kill these works so they don't UAF the HCD.

to something more precise, like this:

* However, we still must wait for the BH work items to finish
* because they access the hcd structure, which is about to be
* deallocated. Any URBs not yet handled will just have to leak.

It's a minor thing.)

Alan Stern