Commit b3cfc30c authored by Roy Luo's avatar Roy Luo Committed by wei li
Browse files

UPSTREAM: usb: gadget: core: flush gadget workqueue after device removal



[ Upstream commit 399a45e5 ]

device_del() 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: 5702f753 ("usb: gadget: udc-core: move sysfs_notify() to a workqueue")
Cc: stable <stable@kernel.org>

Bug: 400887227
Bug: 400301689
Change-Id: Icf64956f8a17b1876388546b679cfd203d9701dc
Signed-off-by: default avatarRoy Luo <royluo@google.com>
Reviewed-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Reviewed-by: default avatarThinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/20250204233642.666991-1-royluo@google.com


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 859cb45a)
Signed-off-by: default avatarwei li <sirius.liwei@honor.corp-partner.google.com>
(cherry picked from commit de3fe451)
parent bad6466b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment