1
0
Fork 0
remarkable-linux/drivers/usb/cdns3
Peter Chen 0404e11ef5 MLK-19601-1 xhci: Fix leaking USB3 shared_hcd at xhci removal
(Merged upstream reviewing patch, and add cdns support -- Peter Chen)

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, cdns/host.c 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>
Tested-by: Peter Chen <peter.chen@nxp.com>
Tested-by: Jack Pham <jackp@codeaurora.org>
Reported-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2018-10-29 11:10:38 +08:00
..
Kconfig
Makefile
cdns3-nxp-reg-def.h MLK-18794-3 usb: cdns3: change the definition of PowerState at XECP_PM_PMCSR 2018-10-29 11:10:38 +08:00
core.c MLK-19258-3 usb: cdns3: core: change the MODULE_ALIAS 2018-10-29 11:10:38 +08:00
core.h MLK-18817 usb: cdns3: gadget: add mutex for role_start and role_stop 2018-10-29 11:10:38 +08:00
dev-regs-macro.h MLK-17062 usb: cdns3: gadget: add test mode support for USB2 2018-10-29 11:10:38 +08:00
dev-regs-map.h
gadget-export.h
gadget.c MLK-19254 usb: cdns3: gadget: set gadget state to be USB_STATE_NOTATTACHED after stop 2018-10-29 11:10:38 +08:00
gadget.h MLK-18609-5 usb: cdns3: gadget: implement setup status completion properly 2018-10-29 11:10:38 +08:00
host-export.h
host.c MLK-19601-1 xhci: Fix leaking USB3 shared_hcd at xhci removal 2018-10-29 11:10:38 +08:00
io.h