mirror-linux/drivers/usb
Elson Roy Serrao 03285557de usb: dwc3: gadget: Reset num TRBs before giving back the request
commit 00f8205ffc upstream.

Consider a scenario where cable disconnect happens when there is an active
usb reqest queued to the UDC. As part of the disconnect we would issue an
end transfer with no interrupt-on-completion before giving back this
request. Since we are giving back the request without skipping TRBs the
num_trbs field of dwc3_request still holds the stale value previously used.
Function drivers re-use same request for a given bind-unbind session and
hence their dwc3_request context gets preserved across cable
disconnect/connect. When such a request gets re-queued after cable connect,
we would increase the num_trbs field on top of the previous stale value
thus incorrectly representing the number of TRBs used. Fix this by
resetting num_trbs field before giving back the request.

Fixes: 09fe1f8d7e ("usb: dwc3: gadget: track number of TRBs per request")
Cc: stable <stable@kernel.org>
Signed-off-by: Elson Roy Serrao <quic_eserrao@quicinc.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Message-ID: <1685654850-8468-1-git-send-email-quic_eserrao@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-06-21 16:00:57 +02:00
..
atm
c67x00
cdns3 usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM 2023-06-09 10:34:20 +02:00
chipidea usb: chipidea: fix missing goto in `ci_hdrc_probe` 2023-05-11 23:03:30 +09:00
class USB: usbtmc: Fix direction for 0-length ioctl control messages 2023-05-24 17:32:48 +01:00
common
core usb: usbfs: Use consistent mmap functions 2023-06-14 11:15:29 +02:00
dwc2 usb: dwc2: fix a devres leak in hw_enable upon suspend resume 2023-03-30 12:49:22 +02:00
dwc3 usb: dwc3: gadget: Reset num TRBs before giving back the request 2023-06-21 16:00:57 +02:00
early
gadget usb: gadget: udc: core: Prevent soft_connect_store() race 2023-06-21 16:00:57 +02:00
host xhci: Fix incorrect tracking of free space on transfer rings 2023-05-24 17:32:49 +01:00
image
isp1760
misc USB: sisusbvga: Add endpoint checks 2023-05-30 14:03:20 +01:00
mon
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:03:30 +09:00
musb
phy
renesas_usbhs
roles
serial USB: serial: option: add Quectel EM061KGL series 2023-06-21 16:00:57 +02:00
storage usb-storage: fix deadlock when a scsi command timeouts more than once 2023-05-24 17:32:48 +01:00
typec usb: typec: Fix fast_role_swap_current show function 2023-06-21 16:00:57 +02:00
usbip
Kconfig
Makefile
usb-skeleton.c