Skip to content

Commit e86103a

Browse files
Robert Dobrowolskigregkh
authored andcommitted
usb: hcd: out of bounds access in for_each_companion
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>
1 parent 1363074 commit e86103a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/usb/core/hcd-pci.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ static void for_each_companion(struct pci_dev *pdev, struct usb_hcd *hcd,
7373
if (companion->bus != pdev->bus ||
7474
PCI_SLOT(companion->devfn) != slot)
7575
continue;
76+
77+
/*
78+
* Companion device should be either UHCI,OHCI or EHCI host
79+
* controller, otherwise skip.
80+
*/
81+
if (companion->class != CL_UHCI && companion->class != CL_OHCI &&
82+
companion->class != CL_EHCI)
83+
continue;
84+
7685
companion_hcd = pci_get_drvdata(companion);
7786
if (!companion_hcd || !companion_hcd->self.root_hub)
7887
continue;

0 commit comments

Comments
 (0)