linux-stable/drivers/usb
Mathias Nyman 219dcadc75 xhci: Fix leaking USB3 shared_hcd at xhci removal
commit f068090426 upstream.

Ensure that the shared_hcd pointer is valid when calling usb_put_hcd()

The shared_hcd is removed and freed in xhci by first calling
usb_remove_hcd(xhci->shared_hcd), and later
usb_put_hcd(xhci->shared_hcd)

Afer commit fe190ed0d6 ("xhci: Do not halt the host until both HCD have
disconnected their devices.") the shared_hcd was never properly put as
xhci->shared_hcd was set to NULL before usb_put_hcd(xhci->shared_hcd) was
called.

shared_hcd (USB3) is removed before primary hcd (USB2).
While removing the primary hcd we might need to handle xhci interrupts
to cleanly remove last USB2 devices, therefore we need to set
xhci->shared_hcd to NULL before removing the primary hcd to let xhci
interrupt handler know shared_hcd is no longer available.

xhci-plat.c, xhci-histb.c and xhci-mtk first create both their hcd's before
adding them. so to keep the correct reverse removal order use a temporary
shared_hcd variable for them.
For more details see commit 4ac53087d6 ("usb: xhci: plat: Create both
HCDs before adding them")

Fixes: fe190ed0d6 ("xhci: Do not halt the host until both HCD have disconnected their devices.")
Cc: Joel Stanley <joel@jms.id.au>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: Thierry Reding <treding@nvidia.com>
Cc: Jianguo Sun <sunjianguo1@huawei.com>
Cc: <stable@vger.kernel.org>
Reported-by: Jack Pham <jackp@codeaurora.org>
Tested-by: Jack Pham <jackp@codeaurora.org>
Tested-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-31 08:13:47 +01:00
..
atm License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
c67x00 c67x00-hcd: constify hc_driver structures 2017-07-30 07:26:52 -07:00
chipidea usb: chipidea: Prevent unbalanced IRQ disable 2018-11-13 11:14:59 -08:00
class usb: cdc-acm: send ZLP for Telit 3G Intel based modems 2019-01-16 22:07:10 +01:00
common USB: ulpi: fix bus-node lookup 2017-12-10 13:40:44 +01:00
core USB: Add USB_QUIRK_DELAY_CTRL_MSG quirk for Corsair K70 RGB 2019-01-16 22:07:11 +01:00
dwc2 dwc2: gadget: Fix ISOC IN DDMA PID bitfield value calculation 2018-08-24 13:09:01 +02:00
dwc3 usb: dwc3: gadget: Clear req->needs_extra_trb flag on cleanup 2019-01-31 08:13:47 +01:00
early USB: early: Use new USB product ID and strings for DbC device 2017-11-21 09:49:21 +01:00
gadget usb: gadget: udc: renesas_usb3: add a safety connection way for forced_b_device 2019-01-26 09:37:02 +01:00
host xhci: Fix leaking USB3 shared_hcd at xhci removal 2019-01-31 08:13:47 +01:00
image License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
isp1760 License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
misc usb: appledisplay: Add 27" Apple Cinema Display 2018-12-13 09:18:51 +01:00
mon usb: usbmon: Read text within supplied buffer size 2018-03-19 08:42:46 +01:00
mtu3 usb: mtu3: fix error return code in ssusb_gadget_init() 2017-12-10 13:40:41 +01:00
musb usb: musb: dsps: do not disable CPPI41 irq in driver teardown 2018-10-03 17:00:55 -07:00
phy usb/phy: fix PPC64 build errors in phy-fsl-usb.c 2018-09-05 09:26:26 +02:00
renesas_usbhs usb: renesas_usbhs: missed the "running" flag in usb_dmac with rx path 2018-02-28 10:19:43 +01:00
serial USB: serial: pl2303: add new PID to support PL2303TB 2019-01-31 08:13:42 +01:00
storage USB: storage: add quirk for SMI SM3350 2019-01-16 22:07:11 +01:00
typec usb: typec: ucsi: Fix for incorrect status data issue 2018-07-08 15:30:47 +02:00
usbip usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten 2018-11-13 11:15:03 -08:00
wusbcore usb: wusbcore: security: cast sizeof to int for comparison 2018-10-03 17:00:49 -07:00
Kconfig usb: Move USB_UHCI_BIG_ENDIAN_* out of USB_SUPPORT 2018-02-22 15:42:31 +01:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
README
usb-skeleton.c

To understand all the Linux-USB framework, you'll use these resources:

    * This source code.  This is necessarily an evolving work, and
      includes kerneldoc that should help you get a current overview.
      ("make pdfdocs", and then look at "usb.pdf" for host side and
      "gadget.pdf" for peripheral side.)  Also, Documentation/usb has
      more information.

    * The USB 2.0 specification (from www.usb.org), with supplements
      such as those for USB OTG and the various device classes.
      The USB specification has a good overview chapter, and USB
      peripherals conform to the widely known "Chapter 9".

    * Chip specifications for USB controllers.  Examples include
      host controllers (on PCs, servers, and more); peripheral
      controllers (in devices with Linux firmware, like printers or
      cell phones); and hard-wired peripherals like Ethernet adapters.

    * Specifications for other protocols implemented by USB peripheral
      functions.  Some are vendor-specific; others are vendor-neutral
      but just standardized outside of the www.usb.org team.

Here is a list of what each subdirectory here is, and what is contained in
them.

core/		- This is for the core USB host code, including the
		  usbfs files and the hub class driver ("hub_wq").

host/		- This is for USB host controller drivers.  This
		  includes UHCI, OHCI, EHCI, and others that might
		  be used with more specialized "embedded" systems.

gadget/		- This is for USB peripheral controller drivers and
		  the various gadget drivers which talk to them.


Individual USB driver directories.  A new driver should be added to the
first subdirectory in the list below that it fits into.

image/		- This is for still image drivers, like scanners or
		  digital cameras.
../input/	- This is for any driver that uses the input subsystem,
		  like keyboard, mice, touchscreens, tablets, etc.
../media/	- This is for multimedia drivers, like video cameras,
		  radios, and any other drivers that talk to the v4l
		  subsystem.
../net/		- This is for network drivers.
serial/		- This is for USB to serial drivers.
storage/	- This is for USB mass-storage drivers.
class/		- This is for all USB device drivers that do not fit
		  into any of the above categories, and work for a range
		  of USB Class specified devices. 
misc/		- This is for all USB device drivers that do not fit
		  into any of the above categories.