From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161023AbbE2NuA (ORCPT ); Fri, 29 May 2015 09:50:00 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:52397 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbbE2Nts (ORCPT ); Fri, 29 May 2015 09:49:48 -0400 Message-ID: <55686E78.2090904@ti.com> Date: Fri, 29 May 2015 16:49:44 +0300 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Mathias Nyman , CC: , , , Kishon Vijay Abraham I Subject: Re: [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error References: <1427977409-7671-1-git-send-email-rogerq@ti.com> <1427977409-7671-6-git-send-email-rogerq@ti.com> <55647FE8.7020507@ti.com> <5568677D.7070200@linux.intel.com> In-Reply-To: <5568677D.7070200@linux.intel.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Mathias, On 29/05/15 16:19, Mathias Nyman wrote: > On 26.05.2015 17:15, Roger Quadros wrote: >> From: Kishon Vijay Abraham I >> >> 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 >> Acked-by: Roger Quadros >> --- >> >> 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 > > Thanks, > As your original patch causing this isn't out yet I'll undo this part from your 5/5 patch. > (prevent broken xhci for some unlucky bisecter) > That is fine. Thanks. cheers, -roger