]> git.ipfire.org Git - thirdparty/linux.git/commit - drivers/usb/dwc3/ep0.c
usb: dwc3: ep0: Properly handle setup_packet_pending scenario in data stage
authorWesley Cheng <quic_wcheng@quicinc.com>
Tue, 12 Jul 2022 01:44:03 +0000 (18:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 14 Jul 2022 14:09:43 +0000 (16:09 +0200)
commit5e76ee96be8f7bbf9416a5edddc8c064e7e7c6ac
treec295eadcbfa898f1d6413adc71cdf12baa5a321f
parent2d937c64e8bf3d9b11b1d62d37fbe97b3cd5dc8d
usb: dwc3: ep0: Properly handle setup_packet_pending scenario in data stage

During a 3 stage SETUP transfer, if the host sends another SETUP token
before completing the status phase, it signifies that the host has aborted
the current control transfer.  Currently, if a setup_packet_pending is
received, there are no subsequent calls to dwc3_ep0_out_start() to fetch
the new SETUP packet.  This leads to a stall on EP0, as host does not
expect another STATUS phase as it has aborted the current transfer.

Fix this issue by explicitly stalling and restarting EP0, as well as
resetting the trb_enqueue indexes.  (without this, there is a chance the
SETUP TRB is set up on trb_endqueue == 1)

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220712014403.2977-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/ep0.c