linux/drivers/usb/host
Mathias Nyman ae4ff9dead xhci: Fix NULL pointer dereference when reading portli debugfs files
Michal reported and debgged a NULL pointer dereference bug in the
recently added portli debugfs files

Oops is caused when there are more port registers counted in
xhci->max_ports than ports reported by Supported Protocol capabilities.
This is possible if max_ports is more than maximum port number, or
if there are gaps between ports of different speeds the 'Supported
Protocol' capabilities.

In such cases port->rhub will be NULL so we can't reach xhci behind it.
Add an explicit NULL check for this case, and print portli in hex
without dereferencing port->rhub.

Reported-by: Michal Pecio <michal.pecio@gmail.com>
Closes: https://lore.kernel.org/linux-usb/20260304103856.48b785fd.michal.pecio@gmail.com
Fixes: 384c57ec72 ("usb: xhci: Add debugfs support for xHCI Port Link Info (PORTLI) register.")
Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://patch.msgid.link/20260304223639.3882398-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-03-11 16:18:48 +01:00
..
Kconfig USB: host: drop unneeded dependency on OF_GPIO 2026-01-07 16:14:11 +01:00
Makefile usb: isp1362-hcd: remove Philips ISP1362 USB OTG controller driver 2026-01-07 16:13:19 +01:00
bcma-hcd.c
ehci-atmel.c
ehci-brcm.c
ehci-dbg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ehci-exynos.c
ehci-fsl.c
ehci-fsl.h
ehci-grlib.c
ehci-hcd.c USB: HCD: remove logic about which hcd is loaded 2026-01-14 15:59:00 +01:00
ehci-hub.c
ehci-mem.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ehci-mv.c
ehci-npcm7xx.c
ehci-omap.c
ehci-orion.c
ehci-pci.c PCI: Add ASPEED vendor ID to pci_ids.h 2026-01-09 14:21:16 -06:00
ehci-platform.c usb: host: ehci-platform: Call reset assert/deassert on suspend/resume 2025-11-21 15:11:22 +01:00
ehci-ppc-of.c
ehci-ps3.c
ehci-q.c
ehci-sched.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ehci-sh.c
ehci-spear.c
ehci-st.c
ehci-sysfs.c
ehci-timer.c
ehci-xilinx-of.c
ehci.h
fhci-dbg.c
fhci-hcd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fhci-hub.c
fhci-mem.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
fhci-q.c
fhci-sched.c
fhci-tds.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
fhci.h
fsl-mph-dr-of.c
isp116x-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
isp116x.h
max3421-hcd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
octeon-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
octeon-hcd.h
ohci-at91.c
ohci-da8xx.c usb: ohci-da8xx: remove unused platform data 2025-11-21 15:13:56 +01:00
ohci-dbg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ohci-exynos.c
ohci-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
ohci-hub.c
ohci-mem.c
ohci-nxp.c usb: ohci-nxp: clean up probe error labels 2025-12-23 15:48:46 +01:00
ohci-omap.c
ohci-pci.c
ohci-platform.c USB: OHCI/UHCI: Add soft dependencies on ehci_platform 2026-01-14 16:02:14 +01:00
ohci-ppc-of.c
ohci-ps3.c
ohci-pxa27x.c
ohci-q.c
ohci-s3c2410.c
ohci-sa1111.c
ohci-sm501.c
ohci-spear.c
ohci-st.c
ohci.h
oxu210hp-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
pci-quirks.c
pci-quirks.h
r8a66597-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
r8a66597.h
sl811-hcd.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
sl811.h
sl811_cs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ssb-hcd.c
uhci-debug.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
uhci-grlib.c
uhci-hcd.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
uhci-hcd.h
uhci-hub.c
uhci-pci.c
uhci-platform.c USB: OHCI/UHCI: Add soft dependencies on ehci_platform 2026-01-14 16:02:14 +01:00
uhci-q.c
xen-hcd.c
xhci-caps.h usb: xhci: Add debugfs support for xHCI Port Link Info (PORTLI) register. 2025-11-21 14:53:01 +01:00
xhci-dbg.c
xhci-dbgcap.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xhci-dbgcap.h xhci: dbc: prepare to expose strings through sysfs 2026-01-23 17:16:24 +01:00
xhci-dbgtty.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xhci-debugfs.c xhci: Fix NULL pointer dereference when reading portli debugfs files 2026-03-11 16:18:48 +01:00
xhci-debugfs.h
xhci-ext-caps.c
xhci-ext-caps.h
xhci-histb.c
xhci-hub.c usb: xhci: standardize single bit-field macros 2025-11-21 14:53:01 +01:00
xhci-mem.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
xhci-mtk-sch.c Convert more 'alloc_obj' cases to default GFP_KERNEL arguments 2026-02-21 20:03:00 -08:00
xhci-mtk.c usb: Remove redundant pm_runtime_mark_last_busy() calls 2025-11-21 15:11:53 +01:00
xhci-mtk.h usb: xhci-mtk: correct most kernel-doc problems in xhci-mtk.h 2025-11-21 14:52:37 +01:00
xhci-mvebu.c
xhci-mvebu.h
xhci-pci-renesas.c
xhci-pci.c usb: xhci: simplify handling of Structural Parameters 1 values 2025-11-21 14:53:00 +01:00
xhci-pci.h
xhci-plat.c
xhci-plat.h
xhci-port.h usb: xhci: Add debugfs support for xHCI Port Link Info (PORTLI) register. 2025-11-21 14:53:01 +01:00
xhci-rcar-regs.h
xhci-rcar.c
xhci-ring.c usb: xhci: Prevent interrupt storm on host controller error (HCE) 2026-03-11 16:18:48 +01:00
xhci-rzg3e-regs.h
xhci-rzv2m.c
xhci-rzv2m.h
xhci-sideband.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
xhci-tegra.c usb: host: tegra: Remove manual wake IRQ disposal 2026-01-23 17:15:54 +01:00
xhci-trace.c
xhci-trace.h usb: xhci: standardize single bit-field macros 2025-11-21 14:53:01 +01:00
xhci.c usb: xhci: Fix memory leak in xhci_disable_slot() 2026-03-11 16:18:48 +01:00
xhci.h usb: xhci: limit number of interrupts to 128 2025-11-21 14:53:00 +01:00