Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: xhci: Fail gracefully if there's no SS ep companion descriptor.

This is a work around for a bug in the SuperSpeed Endpoint Companion Descriptor
parsing code. It fails in some corner cases, which means ep->ss_ep_comp may be
NULL.

Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Sarah Sharp and committed by
Greg Kroah-Hartman
b7d6d998 4a73143c

+6 -1
+6 -1
drivers/usb/host/xhci-mem.c
··· 496 496 max_packet = ep->desc.wMaxPacketSize; 497 497 ep_ctx->ep_info2 |= MAX_PACKET(max_packet); 498 498 /* dig out max burst from ep companion desc */ 499 - max_packet = ep->ss_ep_comp->desc.bMaxBurst; 499 + if (!ep->ss_ep_comp) { 500 + xhci_warn(xhci, "WARN no SS endpoint companion descriptor.\n"); 501 + max_packet = 0; 502 + } else { 503 + max_packet = ep->ss_ep_comp->desc.bMaxBurst; 504 + } 500 505 ep_ctx->ep_info2 |= MAX_BURST(max_packet); 501 506 break; 502 507 case USB_SPEED_HIGH: