usb: xhci: Check for XHCI_PLAT in xhci_cleanup_msix()
authorJack Pham <jackp@codeaurora.org>
Fri, 15 Nov 2013 22:53:14 +0000 (14:53 -0800)
committerSarah Sharp <sarah.a.sharp@linux.intel.com>
Thu, 19 Dec 2013 21:23:56 +0000 (13:23 -0800)
If CONFIG_PCI is enabled, make sure xhci_cleanup_msix()
doesn't try to free a bogus PCI IRQ or dereference an invalid
pci_dev when the xHCI device is actually a platform_device.

This patch should be backported to kernels as old as 3.9, that
contain the commit 52fb61250a7a132b0cfb9f4a1060a1f3c49e5a25
"xhci-plat: Don't enable legacy PCI interrupts."

Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
drivers/usb/host/xhci.c

index 6bc966cfb60e89c22ad4fc724f618b026c9c9eaa..f8ffc512faf14dc391b04de10ea5532ef13eb174 100644 (file)
@@ -325,6 +325,9 @@ static void xhci_cleanup_msix(struct xhci_hcd *xhci)
        struct usb_hcd *hcd = xhci_to_hcd(xhci);
        struct pci_dev *pdev = to_pci_dev(hcd->self.controller);
 
+       if (xhci->quirks & XHCI_PLAT)
+               return;
+
        xhci_free_irq(xhci);
 
        if (xhci->msix_entries) {