Re: [PATCH v1] usb: gadget: core: flush gadget workqueue after device removal
From: Roy Luo
Date: Tue Feb 04 2025 - 18:37:00 EST
On Mon, Feb 3, 2025 at 4:55 PM Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> wrote:
>
> On Tue, Feb 04, 2025, Roy Luo wrote:
> > usb_del_gadget() can lead to new work being scheduled in gadget->work
> > workqueue. This is observed, for example, with the dwc3 driver with the
> > following call stack:
> > device_del()
> > gadget_unbind_driver()
> > usb_gadget_disconnect_locked()
> > dwc3_gadget_pullup()
> > dwc3_gadget_soft_disconnect()
> > usb_gadget_set_state()
> > schedule_work(&gadget->work)
> >
> > Move flush_work() after device_del() to ensure the workqueue is cleaned
> > up.
> >
> > Fixes: 1ff24d40b3c3 ("usb: dwc3: gadget: Fix incorrect UDC state after manual deconfiguration")
>
> The reference should be targeting the udc core. Probably want to Cc
> stable also.
>
Thanks for the review, sending out v2.
Regards,
Roy Luo