]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: xhci: Allow usb_add/remove_hcd() to be called repeatedly
authorRoger Quadros <rogerq@ti.com>
Fri, 29 May 2015 14:01:48 +0000 (17:01 +0300)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 19 Oct 2015 09:54:27 +0000 (10:54 +0100)
commit 8a853759c262fd52ff0f5e89f89c65928077fe4a upstream.

Don't set xhci->shared_hcd to NULL in xhci_stop() as we have
still not de-allocated it. It was resulting in a NULL pointer
de-reference if usb_add/remove_hcd() is called repeatedly.

We want repeated add/remove to work for the OTG use case.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/usb/host/xhci.c

index 4170d913ee6e79787162f2f025c14e84fd6d54c5..d7f3adf56af2ad9bcd809fc586c7bc3775dc8cdb 100644 (file)
@@ -663,12 +663,6 @@ static void xhci_only_stop_hcd(struct usb_hcd *hcd)
 
        spin_lock_irq(&xhci->lock);
        xhci_halt(xhci);
-
-       /* The shared_hcd is going to be deallocated shortly (the USB core only
-        * calls this function when allocation fails in usb_add_hcd(), or
-        * usb_remove_hcd() is called).  So we need to unset xHCI's pointer.
-        */
-       xhci->shared_hcd = NULL;
        spin_unlock_irq(&xhci->lock);
 }