mirror of
https://github.com/torvalds/linux.git
synced 2025-04-12 06:49:52 +00:00
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: 948ce83fbb7df ("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>
This commit is contained in:
parent
c133ec0e57
commit
487cfd4a8e
@ -12,6 +12,7 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/unaligned.h>
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
#include "xhci.h"
|
||||
#include "xhci-trace.h"
|
||||
@ -770,9 +771,16 @@ static int xhci_exit_test_mode(struct xhci_hcd *xhci)
|
||||
enum usb_link_tunnel_mode xhci_port_is_tunneled(struct xhci_hcd *xhci,
|
||||
struct xhci_port *port)
|
||||
{
|
||||
struct usb_hcd *hcd;
|
||||
void __iomem *base;
|
||||
u32 offset;
|
||||
|
||||
/* Don't try and probe this capability for non-Intel hosts */
|
||||
hcd = xhci_to_hcd(xhci);
|
||||
if (!dev_is_pci(hcd->self.controller) ||
|
||||
to_pci_dev(hcd->self.controller)->vendor != PCI_VENDOR_ID_INTEL)
|
||||
return USB_LINK_UNKNOWN;
|
||||
|
||||
base = &xhci->cap_regs->hc_capbase;
|
||||
offset = xhci_find_next_ext_cap(base, 0, XHCI_EXT_CAPS_INTEL_SPR_SHADOW);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user