summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Dobrowolski <robert.dobrowolski@linux.intel.com>2016-03-24 03:30:07 -0700
committerBen Hutchings <ben@decadent.org.uk>2016-06-15 21:28:11 +0100
commit4af9256c89c8dc0b3ada0475debba40ff5303b23 (patch)
treec53bb90098a251f2c9b83f0ae4a28c8c35b4dca8
parent720c21a8806e7e2ccbb9755880d7ee4c4ef60569 (diff)
downloadlinux-stable-4af9256c89c8dc0b3ada0475debba40ff5303b23.tar.gz
linux-stable-4af9256c89c8dc0b3ada0475debba40ff5303b23.tar.bz2
linux-stable-4af9256c89c8dc0b3ada0475debba40ff5303b23.zip
usb: hcd: out of bounds access in for_each_companion
commit e86103a75705c7c530768f4ffaba74cf382910f2 upstream. On BXT platform Host Controller and Device Controller figure as same PCI device but with different device function. HCD should not pass data to Device Controller but only to Host Controllers. Checking if companion device is Host Controller, otherwise skip. Signed-off-by: Robert Dobrowolski <robert.dobrowolski@linux.intel.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [bwh: Backported to 3.2: adjust context] Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--drivers/usb/core/hcd-pci.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index 76be3bae3ff8..8312f9547009 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -70,6 +70,14 @@ static void companion_common(struct pci_dev *pdev, struct usb_hcd *hcd,
PCI_SLOT(companion->devfn) != slot)
continue;
+ /*
+ * Companion device should be either UHCI,OHCI or EHCI host
+ * controller, otherwise skip.
+ */
+ if (companion->class != CL_UHCI && companion->class != CL_OHCI &&
+ companion->class != CL_EHCI)
+ continue;
+
companion_hcd = pci_get_drvdata(companion);
if (!companion_hcd)
continue;