diff options
author | Robert Dobrowolski <robert.dobrowolski@linux.intel.com> | 2016-03-24 03:30:07 -0700 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-04-20 09:41:07 -0400 |
commit | c1ffc7c90954257b66b17eff3a0732dfe449f853 (patch) | |
tree | 713f36fe9b996eab0847ac021b7a1c2c41cc7c7a | |
parent | e6102e3b2f80d5af732587b9f254619a608cbf39 (diff) |
usb: hcd: out of bounds access in for_each_companion
[ Upstream commit e86103a75705c7c530768f4ffaba74cf382910f2 ]
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.
Cc: <stable@vger.kernel.org>
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>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r-- | drivers/usb/core/hcd-pci.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c index efc953119ce2..a4c0b855faeb 100644 --- a/drivers/usb/core/hcd-pci.c +++ b/drivers/usb/core/hcd-pci.c @@ -74,6 +74,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd, if (companion->bus != pdev->bus || 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 || !companion_hcd->self.root_hub) continue; |