Skip to content

Commit 487cfd4

Browse files
Marc Zyngiergregkh
authored andcommitted
xhci: Restrict USB4 tunnel detection for USB3 devices to Intel hosts
When adding support for USB3-over-USB4 tunnelling detection, a check for an Intel-specific capability was added. This capability, which goes by ID 206, is used without any check that we are actually dealing with an Intel host. As it turns out, the Cadence XHCI controller *also* exposes an extended capability numbered 206 (for unknown purposes), but of course doesn't have the Intel-specific registers that the tunnelling code is trying to access. Fun follows. The core of the problems is that the tunnelling code blindly uses vendor-specific capabilities without any check (the Intel-provided documentation I have at hand indicates that 192-255 are indeed vendor-specific). Restrict the detection code to Intel HW for real, preventing any further explosion on my (non-Intel) HW. Cc: stable <stable@kernel.org> Fixes: 948ce83 ("xhci: Add USB4 tunnel detection for USB3 devices on Intel hosts") Signed-off-by: Marc Zyngier <maz@kernel.org> Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20250227194529.2288718-1-maz@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c133ec0 commit 487cfd4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/usb/host/xhci-hub.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/slab.h>
1313
#include <linux/unaligned.h>
1414
#include <linux/bitfield.h>
15+
#include <linux/pci.h>
1516

1617
#include "xhci.h"
1718
#include "xhci-trace.h"
@@ -770,9 +771,16 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
770771
enum usb_link_tunnel_mode xhci_port_is_tunneled(struct xhci_hcd *xhci,
771772
struct xhci_port *port)
772773
{
774+
struct usb_hcd *hcd;
773775
void __iomem *base;
774776
u32 offset;
775777

778+
/* Don't try and probe this capability for non-Intel hosts */
779+
hcd = xhci_to_hcd(xhci);
780+
if (!dev_is_pci(hcd->self.controller) ||
781+
to_pci_dev(hcd->self.controller)->vendor != PCI_VENDOR_ID_INTEL)
782+
return USB_LINK_UNKNOWN;
783+
776784
base = &xhci->cap_regs->hc_capbase;
777785
offset = xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_INTEL_SPR_SHADOW);
778786

0 commit comments

Comments
 (0)