usb: dwc3: gadget: Disable gadget IRQ during pullup disable
authorWesley Cheng <wcheng@codeaurora.org>
Fri, 21 May 2021 04:23:57 +0000 (21:23 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jun 2021 10:01:44 +0000 (12:01 +0200)
commit9e0677c2e39052ac20efae4474bb20614d9a88c9
tree1f581fb923d8bc9978ea7afb3a5f18b3aaeebaa1
parentcc440da4aad9dc9f2a9a9ebd9ddf3c23f36ff2fc
usb: dwc3: gadget: Disable gadget IRQ during pullup disable

commit 8212937305f84ef73ea81036dafb80c557583d4b upstream.

Current sequence utilizes dwc3_gadget_disable_irq() alongside
synchronize_irq() to ensure that no further DWC3 events are generated.
However, the dwc3_gadget_disable_irq() API only disables device
specific events.  Endpoint events can still be generated.  Briefly
disable the interrupt line, so that the cleanup code can run to
prevent device and endpoint events. (i.e. __dwc3_gadget_stop() and
dwc3_stop_active_transfers() respectively)

Without doing so, it can lead to both the interrupt handler and the
pullup disable routine both writing to the GEVNTCOUNT register, which
will cause an incorrect count being read from future interrupts.

Fixes: ae7e86108b12 ("usb: dwc3: Stop active transfers before halting the controller")
Signed-off-by: Wesley Cheng <wcheng@codeaurora.org>
Link: https://lore.kernel.org/r/1621571037-1424-1-git-send-email-wcheng@codeaurora.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c