linux/drivers/usb
Elson Roy Serrao 1938f080a1 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>
History 2023-06-21 15:59:15 +02:00
..
atm usb: atm: cxacru: Fix typo in comment 2021-05-21 20:05:40 +02:00
c67x00 usb/c67x00: Replace tasklet with work 2021-01-26 18:36:37 +01:00
cdns3 usb: cdns3: fix NCM gadget RX speed 20x slow than expection at iMX8QM 2023-06-09 10:32:31 +02:00
chipidea usb: chipidea: fix missing goto in ci_hdrc_probe 2023-05-11 23:00:33 +09:00
class USB: usbtmc: Fix direction for 0-length ioctl control messages 2023-05-24 17:36:52 +01:00
common Revert "usb: ulpi: defer ulpi_register on ulpi_read_id timeout" 2023-01-18 11:48:58 +01:00
core usb: usbfs: Use consistent mmap functions 2023-06-14 11:13:07 +02:00
dwc2 usb: dwc2: fix a devres leak in hw_enable upon suspend resume 2023-03-30 12:47:55 +02:00
dwc3 usb: dwc3: gadget: Reset num TRBs before giving back the request 2023-06-21 15:59:15 +02:00
early usb: early: xhci-dbc: Fix a potential out-of-bound memory access 2023-03-10 09:39:39 +01:00
gadget usb: gadget: f_fs: Add unbind event before functionfs_unbind 2023-06-09 10:32:29 +02:00
host xhci: Fix incorrect tracking of free space on transfer rings 2023-05-24 17:36:53 +01:00
image USB: microtek: use set_host_byte() 2020-09-16 12:42:10 +02:00
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-06-09 10:22:27 +02:00
misc USB: sisusbvga: Add endpoint checks 2023-05-30 13:55:31 +01:00
mon usb: mon: make mmapped memory read only 2022-10-12 09:53:28 +02:00
mtu3 usb: mtu3: fix kernel panic at qmu transfer done irq handler 2023-05-11 23:00:33 +09:00
musb usb: musb: mediatek: don't unregister something that wasn't registered 2023-03-10 09:39:40 +01:00
phy extcon: Fix extcon_get_extcon_dev() error handling 2022-06-14 18:36:21 +02:00
renesas_usbhs usb: renesas: Fix refcount leak bug 2022-08-25 11:40:33 +02:00
roles usb: roles: fix of node refcount leak in usb_role_switch_is_parent() 2022-12-31 13:14:30 +01:00
serial USB: serial: option: add Quectel EM061KGL series 2023-06-21 15:59:15 +02:00
storage usb-storage: fix deadlock when a scsi command timeouts more than once 2023-05-24 17:36:52 +01:00
typec usb: typec: altmodes/displayport: fix pin_assignment_show 2023-05-24 17:36:53 +01:00
usbip usb: usbip: add missing device lock on tweak configuration cmd 2022-06-14 18:36:04 +02:00
Kconfig usb: remove reference to deleted config STB03xxx 2021-08-18 15:32:19 +02:00
Makefile usb: host: remove line for obsolete config USB_HWA_HCD 2021-08-18 15:32:19 +02:00
usb-skeleton.c USB: usb-skeleton: drop redundant in-urb check 2019-10-10 12:41:19 +02:00