linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Roger Quadros <rogerq@ti.com>, mathias.nyman@intel.com
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Kishon Vijay Abraham I <kishon@ti.com>
Subject: Re: [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error
Date: Fri, 29 May 2015 16:19:57 +0300	[thread overview]
Message-ID: <5568677D.7070200@linux.intel.com> (raw)
In-Reply-To: <55647FE8.7020507@ti.com>

On 26.05.2015 17:15, Roger Quadros wrote:
> From: Kishon Vijay Abraham I <kishon@ti.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@ti.com>
> Acked-by: Roger Quadros <rogerq@ti.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

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)

-Mathias

  reply	other threads:[~2015-05-29 13:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-02 12:23 [PATCH 0/5] usb: xhci: fixes for OTG/DRD use Roger Quadros
2015-04-02 12:23 ` [PATCH 1/5] usb: xhci: cleanup xhci_hcd allocation Roger Quadros
2015-04-07 14:23   ` Mathias Nyman
2015-04-09  9:22     ` Roger Quadros
2015-04-13 12:48       ` Mathias Nyman
2015-04-14  9:21         ` Roger Quadros
2015-05-11 14:18         ` Roger Quadros
2015-05-12 14:22           ` Mathias Nyman
2015-05-25 15:05             ` Mathias Nyman
2015-05-26 16:31               ` Andrew Bresticker
2015-04-02 12:23 ` [PATCH 2/5] usb: xhci: plat: Create both HCDs before adding them Roger Quadros
2015-04-20 12:35   ` Mathias Nyman
2015-04-21  9:49     ` Roger Quadros
2015-04-21  7:11       ` Roger Quadros
2015-04-21  8:08       ` Maxime Ripard
2015-04-21 10:46         ` Roger Quadros
2015-04-22 13:46           ` Maxime Ripard
2015-04-02 12:23 ` [PATCH 3/5] usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly Roger Quadros
2015-04-02 12:23 ` [PATCH 4/5] usb: xhci: fix xhci locking up during hcd remove Roger Quadros
2015-04-02 12:23 ` [PATCH 5/5] usb: xhci: Fix suspend/resume when used with OTG core Roger Quadros
2015-05-26 14:15   ` [PATCH] usb: host: xhci-pci: Fix NULL pointer dereference error Roger Quadros
2015-05-29 13:19     ` Mathias Nyman [this message]
2015-05-29 13:49       ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5568677D.7070200@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rogerq@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).