lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55647FE8.7020507@ti.com>
Date:	Tue, 26 May 2015 17:15:04 +0300
From:	Roger Quadros <rogerq@...com>
To:	<mathias.nyman@...el.com>
CC:	<gregkh@...uxfoundation.org>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>,
	Kishon Vijay Abraham I <kishon@...com>
Subject: [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error

From: Kishon Vijay Abraham I <kishon@...com>

commit 3b8295d5cbf2 (usb: xhci: Fix suspend/resume when used
with OTG core) removes assigning xhci->main_hcd from xhci_gen_setup
and adds it in the probe of xhci-plat and xhci-pci.

In the case of xhci-pci, xhci_mem_init is invoked before main_hcd is
initialized in the probe causing a null pointer deferencing error
when a PCIe usb controller card is plugged in.

Fix it by initializing xhci->main_hcd in xhci_gen_setup and removing
it from xhci_pci_probe().

Signed-off-by: Kishon Vijay Abraham I <kishon@...com>
Acked-by: Roger Quadros <rogerq@...com>
---

  drivers/usb/host/xhci-pci.c |    1 -
  drivers/usb/host/xhci.c     |    1 +
  2 files changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 11f16cb..67b9529 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -230,7 +230,6 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
  	/* USB 2.0 roothub is stored in the PCI device now. */
  	hcd = dev_get_drvdata(&dev->dev);
  	xhci = hcd_to_xhci(hcd);
-	xhci->main_hcd = hcd;
  	xhci->shared_hcd = usb_create_shared_hcd(driver, &dev->dev,
  				pci_name(dev), hcd);
  	if (!xhci->shared_hcd) {
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 397c0dd..b14f572 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -4842,6 +4842,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks)
  		 */
  		hcd->speed = HCD_USB2;
  		hcd->self.root_hub->speed = USB_SPEED_HIGH;
+		xhci->main_hcd = hcd;
  		/*
  		 * USB 2.0 roothub under xHCI has an integrated TT,
  		 * (rate matching hub) as opposed to having an OHCI/UHCI
-- 
1.7.9.5



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ