linux/drivers/usb/host
Mathias Nyman fe82f16aaf xhci: Fix incorrect tracking of free space on transfer rings
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-16 16:57:49 +02:00
..
bcma-hcd.c USB: bcma: Make GPIO explicitly optional 2022-11-08 16:39:56 +01:00
ehci-atmel.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-brcm.c USB: ehci_brcm_hub_control: Improve port index sanitizing 2021-11-17 14:34:18 +01:00
ehci-dbg.c usb: host: {e|o}hci-dbg: kill useless 'ret' variable initializers 2022-02-15 15:11:20 +01:00
ehci-exynos.c usb: host: ehci-exynos: Convert to devm_of_phy_optional_get() 2023-02-03 11:19:35 +05:30
ehci-fsl.c usb: host: ehci-fsl: Use DRV_NAME 2023-01-24 18:11:49 +01:00
ehci-fsl.h
ehci-grlib.c usb: Check !irq instead of irq == NO_IRQ 2022-11-11 10:28:38 +01:00
ehci-hcd.c usb: reduce kernel log spam on driver registration 2022-08-31 09:07:53 +02:00
ehci-hub.c USB: EHCI: Improve port index sanitizing 2021-10-05 12:52:03 +02:00
ehci-mem.c usb: host: ehci: Make use of dma_pool_zalloc() instead of dma_pool_alloc/memset() 2021-10-21 12:47:56 +02:00
ehci-mv.c usb: host: ehci-mv: drop duplicated MODULE_ALIAS 2021-09-21 16:33:00 +02:00
ehci-npcm7xx.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-omap.c usb: reduce kernel log spam on driver registration 2022-08-31 09:07:53 +02:00
ehci-orion.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-pci.c usb: ehci-pci: Set PROBE_PREFER_ASYNCHRONOUS 2022-11-09 12:36:19 +01:00
ehci-platform.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-ppc-of.c usb: Use of_property_read_bool() for boolean properties 2023-03-16 12:14:56 +01:00
ehci-ps3.c
ehci-q.c usb: ehci: Use endpoint in URB to get maxpacket 2022-08-31 09:07:53 +02:00
ehci-sched.c usb: host: ehci-sched: Use struct_size() in kzalloc() 2022-01-26 13:50:07 +01:00
ehci-sh.c Revert "usb: host: ehci-sh: propagate errors from platform_get_irq()" 2021-12-21 07:14:05 +01:00
ehci-spear.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-st.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ehci-sysfs.c
ehci-timer.c
ehci-xilinx-of.c usb: host: ehci-xilinx: adding description for return value 2022-05-12 13:58:48 +02:00
ehci.h usb: host: fix a typo in ehci.h 2022-11-29 08:56:09 +01:00
fhci-dbg.c
fhci-hcd.c USB/Thunderbolt driver changes for 6.2-rc1 2022-12-16 03:22:53 -08:00
fhci-hub.c USB: FHCI: Switch to GPIO descriptors 2022-09-01 16:08:29 +02:00
fhci-mem.c
fhci-q.c
fhci-sched.c
fhci-tds.c
fhci.h USB: FHCI: Switch to GPIO descriptors 2022-09-01 16:08:29 +02:00
fsl-mph-dr-of.c usb: Use of_property_read_bool() for boolean properties 2023-03-16 12:14:56 +01:00
isp116x-hcd.c USB: isp116x: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:42 +01:00
isp116x.h
isp1362-hcd.c USB: isp1362: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:42 +01:00
isp1362.h
Kconfig usb: host: u132-hcd: Delete driver 2023-03-21 14:06:11 +01:00
Makefile usb: host: u132-hcd: Delete driver 2023-03-21 14:06:11 +01:00
max3421-hcd.c usb: host: max3421-hcd: drop of_match_ptr for ID table 2023-03-16 12:15:23 +01:00
octeon-hcd.c staging: octeon-usb: move driver out of staging 2022-06-21 16:43:37 +02:00
octeon-hcd.h staging: octeon-usb: move driver out of staging 2022-06-21 16:43:37 +02:00
ohci-at91.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ohci-da8xx.c usb: reduce kernel log spam on driver registration 2022-08-31 09:07:53 +02:00
ohci-dbg.c usb: host: {e|o}hci-dbg: kill useless 'ret' variable initializers 2022-02-15 15:11:20 +01:00
ohci-exynos.c usb: host: ohci-exynos: Convert to devm_of_phy_optional_get() 2023-02-03 11:19:35 +05:30
ohci-hcd.c usb: remove ohci-tmio driver 2023-02-01 17:23:38 +01:00
ohci-hub.c usb: ohci: disable start-of-frame interrupt in ohci_rh_suspend 2021-10-21 12:48:18 +02:00
ohci-mem.c
ohci-nxp.c usb: reduce kernel log spam on driver registration 2022-08-31 09:07:53 +02:00
ohci-omap.c usb: ohci-omap: avoid unused-variable warning 2023-02-01 17:29:30 +01:00
ohci-pci.c USB: hcd-pci: Drop the unused id parameter from usb_hcd_pci_probe() 2022-09-01 16:08:35 +02:00
ohci-platform.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ohci-ppc-of.c usb: Check !irq instead of irq == NO_IRQ 2022-11-11 10:28:38 +01:00
ohci-ps3.c
ohci-pxa27x.c ARM: pxa: remove unused pxa3xx-ulpi 2023-01-20 11:24:04 +01:00
ohci-q.c
ohci-s3c2410.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ohci-sa1111.c ARM: sa1100: remove unused board files 2023-01-12 10:53:12 +01:00
ohci-sm501.c USB: ohci-sm501: Fix typo in comment 2022-06-21 16:39:39 +02:00
ohci-spear.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ohci-st.c usb: clean up after dropping driver registration log spam 2022-09-05 13:23:28 +02:00
ohci.h
oxu210hp-hcd.c usb: host: oxu210hp-hcd: Replace fake flex-array with flexible-array member 2023-03-09 15:29:55 +01:00
pci-quirks.c usb: pci-quirks: Reduce the length of a spinlock section in usb_amd_find_chipset_info() 2023-03-29 09:02:19 +02:00
pci-quirks.h
r8a66597-hcd.c usb: remove third argument of usb_maxpacket() 2022-04-23 10:33:53 +02:00
r8a66597.h
sl811-hcd.c USB: sl811: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:42 +01:00
sl811.h
sl811_cs.c
ssb-hcd.c
uhci-debug.c
uhci-grlib.c usb: Check !irq instead of irq == NO_IRQ 2022-11-11 10:28:38 +01:00
uhci-hcd.c USB: uhci: fix memory leak with using debugfs_lookup() 2023-02-06 13:46:42 +01:00
uhci-hcd.h usb/host: fix repeated words in comments 2022-07-27 14:33:33 +02:00
uhci-hub.c
uhci-pci.c USB: UHCI: adjust zhaoxin UHCI controllers OverCurrent bit value 2023-05-13 17:55:45 +09:00
uhci-platform.c usb: uhci: Use platform_get_irq() to get the interrupt 2021-12-17 16:52:21 +01:00
uhci-q.c
xen-hcd.c xen: make remove callback of xen driver void returned 2022-12-15 16:06:10 +01:00
xhci-dbg.c
xhci-dbgcap.c xhci: dbc: Provide sysfs option to configure dbc descriptors 2023-03-23 17:25:22 +01:00
xhci-dbgcap.h xhci: dbc: Provide sysfs option to configure dbc descriptors 2023-03-23 17:25:22 +01:00
xhci-dbgtty.c xhci: dbgtty: use IDR to support several dbc instances. 2022-02-17 16:20:45 +01:00
xhci-debugfs.c xhci: fix debugfs register accesses while suspended 2023-04-20 10:13:06 +02:00
xhci-debugfs.h
xhci-ext-caps.c
xhci-ext-caps.h
xhci-histb.c
xhci-hub.c xhci: decouple usb2 port resume and get_port_status request handling 2023-02-02 16:44:42 +01:00
xhci-mem.c xhci: mem: Join string literals back 2023-03-23 17:25:22 +01:00
xhci-mtk-sch.c usb: xhci-mtk: fix bandwidth release issue 2022-08-19 10:39:08 +02:00
xhci-mtk.c usb: xhci-mtk: add optional frame count clock 2023-04-20 10:13:39 +02:00
xhci-mtk.h usb: xhci-mtk: add optional frame count clock 2023-04-20 10:13:39 +02:00
xhci-mvebu.c usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math 2023-02-06 13:46:42 +01:00
xhci-mvebu.h Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720" 2022-02-25 19:12:21 +05:30
xhci-pci-renesas.c usb: renesas-xhci: Do not print any log while fw verif success 2022-07-27 14:37:48 +02:00
xhci-pci.c xhci-pci: Only run d3cold avoidance quirk for s2idle 2023-05-16 16:57:49 +02:00
xhci-pci.h usb: renesas-xhci: Remove renesas_xhci_pci_exit() 2021-07-21 10:05:59 +02:00
xhci-plat.c usb: xhci: plat: Add USB 3.0 phy support 2023-04-20 10:13:21 +02:00
xhci-plat.h xhci: split out rcar/rz support from xhci-plat.c 2023-02-02 11:12:59 +01:00
xhci-rcar.c usb: host: xhci-rcar: drop of_match_ptr for ID table 2023-03-16 12:15:22 +01:00
xhci-ring.c xhci: Fix incorrect tracking of free space on transfer rings 2023-05-16 16:57:49 +02:00
xhci-rzv2m.c xhci: host: Add Renesas RZ/V2M SoC support 2023-01-25 15:48:17 +01:00
xhci-rzv2m.h xhci: host: Add Renesas RZ/V2M SoC support 2023-01-25 15:48:17 +01:00
xhci-tegra.c Merge 6.3-rc6 into usb-next 2023-04-10 08:56:59 +02:00
xhci-trace.c xhci: Move functions to setup msi to xhci-pci 2023-03-23 17:25:22 +01:00
xhci-trace.h usb: xhci: change some trace event __dynamic_array() to __get_buf() 2023-03-09 15:35:03 +01:00
xhci.c Merge 6.3-rc6 into usb-next 2023-04-10 08:56:59 +02:00
xhci.h xhci-pci: Only run d3cold avoidance quirk for s2idle 2023-05-16 16:57:49 +02:00