Files
kernel_arpi/drivers
Wesley Cheng ef6a831b6d UPSTREAM: 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 <balbi@kernel.org>
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/20210917021852.2037-1-wcheng@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Bug: 200287549
(cherry picked from commit 8217f07a50236779880f13e87f99224cd9117f83)
Change-Id: Ie7d378c5ae5637cca10f254fa403ef2cd3af7d50
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
2022-04-06 20:07:31 -07:00
..
2022-03-16 12:53:52 +01:00
2022-03-29 12:52:53 +02:00
2022-03-18 07:55:37 +01:00
2022-03-29 12:52:53 +02:00
2022-03-18 07:55:37 +01:00
2022-03-08 19:12:31 +01:00
2022-03-02 11:48:04 +01:00
2022-02-23 12:30:26 +01:00
2022-03-18 07:55:37 +01:00
2022-01-31 12:35:09 +01:00
2022-02-16 14:14:18 +01:00
2022-03-18 07:55:37 +01:00
2022-03-29 12:52:53 +02:00
2022-03-17 14:02:09 +01:00
2022-03-18 07:55:37 +01:00
2022-01-31 12:35:09 +01:00
2022-02-02 09:32:24 +01:00
2022-03-18 07:55:37 +01:00
2021-12-22 09:32:39 +01:00