diff options
| author | Wesley Cheng <[email protected]> | 2021-09-17 02:18:52 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <[email protected]> | 2021-09-21 14:35:03 +0000 |
| commit | 8217f07a50236779880f13e87f99224cd9117f83 (patch) | |
| tree | b2818c1e342b8560abf1ff5bb713be38dd7a8ecf /drivers/usb/class/cdc-acm.c | |
| parent | usb: core: hcd: fix messages in usb_hcd_request_irqs() (diff) | |
| download | kernel-8217f07a50236779880f13e87f99224cd9117f83.tar.gz kernel-8217f07a50236779880f13e87f99224cd9117f83.zip | |
usb: dwc3: gadget: Avoid starting DWC3 gadget during UDC unbind
There is a race present where the DWC3 runtime resume runs in parallel
to the UDC unbind sequence. This will eventually lead to a possible
scenario where we are enabling the run/stop bit, without a valid
composition defined.
Thread#1 (handling UDC unbind):
usb_gadget_remove_driver()
-->usb_gadget_disconnect()
-->dwc3_gadget_pullup(0)
--> continue UDC unbind sequence
-->Thread#2 is running in parallel here
Thread#2 (handing next cable connect)
__dwc3_set_mode()
-->pm_runtime_get_sync()
-->dwc3_gadget_resume()
-->dwc->gadget_driver is NOT NULL yet
-->dwc3_gadget_run_stop(1)
--> _dwc3gadget_start()
...
Fix this by tracking the pullup disable routine, and avoiding resuming
of the DWC3 gadget. Once the UDC is re-binded, that will trigger the
pullup enable routine, which would handle enabling the DWC3 gadget.
Acked-by: Felipe Balbi <[email protected]>
Signed-off-by: Wesley Cheng <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Diffstat (limited to 'drivers/usb/class/cdc-acm.c')
0 files changed, 0 insertions, 0 deletions
