linux/drivers/usb
Mathias Nyman 831a1ffb0a xhci: Fix incorrect tracking of free space on transfer rings
commit fe82f16aaf upstream.

This incorrect tracking caused unnecessary ring expansion in some
usecases which over days of use consume a lot of memory.

xhci driver tries to keep track of free transfer blocks (TRBs) on the
ring buffer, but failed to add back some cancelled transfers that were
turned into no-op operations instead of just moving past them.

This can happen if there are several queued pending transfers which
then are cancelled in reverse order.

Solve this by counting the numer of steps we move the dequeue pointer
once we complete a transfer, and add it to the number of free trbs
instead of just adding the trb number of the current transfer.
This way we ensure we count the no-op trbs on the way as well.

Fixes: 55f6153d8c ("xhci: remove extra loop in interrupt context")
Cc: stable@vger.kernel.org
Reported-by: Miller Hunter <MillerH@hearthnhome.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217242
Tested-by: Miller Hunter <MillerH@hearthnhome.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20230515134059.161110-3-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-24 17:36:53 +01:00
..
atm
c67x00
cdns3 usb: cdnsp: Fixes error: uninitialized symbol 'len' 2023-04-13 16:48:20 +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: fix memory leak with using debugfs_lookup() 2023-03-11 13:57:34 +01: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: debugfs: Resume dwc3 before accessing registers 2023-05-24 17:36:52 +01: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: u_ether: Fix host MAC address case 2023-05-24 17:36:52 +01:00
host xhci: Fix incorrect tracking of free space on transfer rings 2023-05-24 17:36:53 +01:00
image
isp1760 usb: isp1760: Fix out-of-bounds array access 2022-06-09 10:22:27 +02:00
misc USB: misc: iowarrior: fix up header size for USB_DEVICE_ID_CODEMERCS_IOW100 2023-01-24 07:22:45 +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 UNISOC vendor and TOZED LT70C product 2023-05-01 08:23:23 +09: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
Makefile
usb-skeleton.c