linux-stable/drivers/usb/host
Roger Quadros 448116bfa8 usb: xhci: exit early in xhci_setup_device() if we're halted or dying
During quick plug/removal of OTG adapter during dual-role testing
it can happen that xhci_alloc_device() is called for the newly
detected device after the DRD library has called xhci_stop to
remove the HCD.

If that is the case, just fail early to prevent the following warning.

[  154.732649] hub 4-0:1.0: USB hub found
[  154.742204] hub 4-0:1.0: 1 port detected
[  154.824458] hub 3-0:1.0: state 7 ports 1 chg 0002 evt 0000
[  154.854609] hub 4-0:1.0: state 7 ports 1 chg 0000 evt 0000
[  154.944430] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[  154.951009] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.038191] xhci-hcd xhci-hcd.0.auto: remove, state 4
[  155.043315] usb usb4: USB disconnect, device number 1
[  155.055270] xhci-hcd xhci-hcd.0.auto: xhci_stop
[  155.060094] xhci-hcd xhci-hcd.0.auto: USB bus 4 deregistered
[  155.066576] xhci-hcd xhci-hcd.0.auto: remove, state 1
[  155.071710] usb usb3: USB disconnect, device number 1
[  155.077124] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.082389] ------------[ cut here ]------------
[  155.087690] WARNING: CPU: 0 PID: 72 at drivers/usb/host/xhci.c:3800 xhci_setup_device+0x410/0x484 [xhci_hcd]()
[  155.097861] Modules linked in: sd_mod usb_storage scsi_mod usb_f_ss_lb g_zero libcomposite ipv6 xhci_plat_hcd xhci_hcd usbcore dwc3 udc_core evdev ti_am335x_adc joydev kfifo_buf industrialio snd_soc_simple_cc
[  155.146734] CPU: 0 PID: 72 Comm: kworker/0:3 Tainted: G        W       4.1.4-00834-gcd9380b-dirty #50
[  155.156073] Hardware name: Generic AM43 (Flattened Device Tree)
[  155.162117] Workqueue: usb_hub_wq hub_event [usbcore]
[  155.167249] Backtrace:
[  155.169751] [<c0012af0>] (dump_backtrace) from [<c0012c8c>] (show_stack+0x18/0x1c)
[  155.177390]  r6:c089d4a4 r5:ffffffff r4:00000000 r3:ee46c000
[  155.183137] [<c0012c74>] (show_stack) from [<c05f7c14>] (dump_stack+0x84/0xd0)
[  155.190446] [<c05f7b90>] (dump_stack) from [<c00439ac>] (warn_slowpath_common+0x80/0xbc)
[  155.198605]  r7:00000009 r6:00000ed8 r5:bf27eb70 r4:00000000
[  155.204348] [<c004392c>] (warn_slowpath_common) from [<c0043a0c>] (warn_slowpath_null+0x24/0x2c)
[  155.213202]  r8:ee49f000 r7:ee7c0004 r6:00000000 r5:ee7c0158 r4:ee7c0000
[  155.220051] [<c00439e8>] (warn_slowpath_null) from [<bf27eb70>] (xhci_setup_device+0x410/0x484 [xhci_hcd])
[  155.229816] [<bf27e760>] (xhci_setup_device [xhci_hcd]) from [<bf27ec10>] (xhci_address_device+0x14/0x18 [xhci_hcd])
[  155.240415]  r10:ee598200 r9:00000001 r8:00000002 r7:00000001 r6:00000003 r5:00000002
[  155.248363]  r4:ee49f000
[  155.250978] [<bf27ebfc>] (xhci_address_device [xhci_hcd]) from [<bf20cb94>] (hub_port_init+0x1b8/0xa9c [usbcore])
[  155.261403] [<bf20c9dc>] (hub_port_init [usbcore]) from [<bf2101e0>] (hub_event+0x738/0x1020 [usbcore])
[  155.270874]  r10:ee598200 r9:ee7c0000 r8:ee7c0038 r7:ee518800 r6:ee49f000 r5:00000001
[  155.278822]  r4:00000000
[  155.281426] [<bf20faa8>] (hub_event [usbcore]) from [<c005754c>] (process_one_work+0x128/0x340)
[  155.290196]  r10:00000000 r9:00000003 r8:00000000 r7:fedfa000 r6:eeec5400 r5:ee598314
[  155.298151]  r4:ee434380
[  155.300718] [<c0057424>] (process_one_work) from [<c00578f8>] (worker_thread+0x158/0x49c)
[  155.308963]  r10:ee434380 r9:00000003 r8:eeec5400 r7:00000008 r6:ee434398 r5:eeec5400
[  155.316913]  r4:eeec5414
[  155.319482] [<c00577a0>] (worker_thread) from [<c005cc40>] (kthread+0xdc/0xf8)
[  155.326765]  r10:00000000 r9:00000000 r8:00000000 r7:c00577a0 r6:ee434380 r5:ee4441c0
[  155.334713]  r4:00000000 r3:00000000
[  155.338341] [<c005cb64>] (kthread) from [<c000fc08>] (ret_from_fork+0x14/0x2c)
[  155.345626]  r7:00000000 r6:00000000 r5:c005cb64 r4:ee4441c0
[  155.356108] ---[ end trace a58d34c223b190e6 ]---
[  155.360783] xhci-hcd xhci-hcd.0.auto: Virt dev invalid for slot_id 0x1!
[  155.574404] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.579667] ------------[ cut here ]------------

Cc: <stable@vger.kernel.org>
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>
2015-09-21 22:50:44 -07:00
..
whci USB: whci-hcd: Delete an unnecessary check before the function call "usb_put_hcd" 2015-03-18 16:56:40 +01:00
bcma-hcd.c USB: bcma: add support for controlling bus power through GPIO 2015-07-22 15:43:34 -07:00
ehci-atmel.c USB: ehci-atmel: rework clk handling 2015-03-18 13:28:35 +01:00
ehci-dbg.c USB: ehci-dbg.c: move assignment out of if () block 2015-05-10 16:01:10 +02:00
ehci-exynos.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ehci-fsl.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-08-14 16:50:36 -07:00
ehci-fsl.h drivers: usb: fsl: Define usb control register mask for w1c bits 2015-07-22 16:44:35 -07:00
ehci-grlib.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-hcd.c drivers:usb:fsl: Fix compilation error for fsl ehci drv 2015-05-31 16:14:07 +09:00
ehci-hub.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-08-14 16:50:36 -07:00
ehci-mem.c USB: EHCI: don't allocate hardware periodic table atomically by default 2014-07-09 16:16:07 -07:00
ehci-msm.c Revert "usb: host: ehci-msm: Use devm_ioremap_resource instead of devm_ioremap" 2015-04-28 12:51:30 +02:00
ehci-mv.c host: ehci-mv: remove duplicate check on resource 2014-11-07 09:01:50 -08:00
ehci-mxc.c host: ehci-mxc: remove duplicate check on resource 2014-11-07 09:01:50 -08:00
ehci-omap.c
ehci-orion.c usb: ehci-orion: add more constants for register values 2015-03-26 10:50:52 +01:00
ehci-pci.c ehci-pci: disable for Intel MID platforms (update) 2015-02-03 15:28:31 -08:00
ehci-platform.c usb: ehci-platform: Fix using multiple controllers from OF 2015-08-05 12:29:19 -07:00
ehci-pmcmsp.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-ppc-of.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-ps3.c
ehci-q.c
ehci-sched.c USB: EHCI: adjust error return code 2015-01-09 09:58:49 -08:00
ehci-sead3.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-sh.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-spear.c host: ehci-spear: remove duplicate check on resource 2014-11-07 09:01:51 -08:00
ehci-st.c usb: host: ehci-st: Simplify return statement 2015-08-05 12:37:21 -07:00
ehci-sysfs.c usb: host: ehci-sys: delete useless bus_to_hcd conversion 2015-08-18 10:05:23 -07:00
ehci-tegra.c USB: ehci-tegra: fix inefficient copy of unaligned buffers 2015-05-08 01:43:44 +02:00
ehci-tilegx.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci-timer.c
ehci-w90x900.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ehci-xilinx-of.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ehci.h drivers: usb: fsl: Workaround for USB erratum-A005275 2015-08-14 16:50:36 -07:00
fhci-dbg.c drivers/usb/host/fhci-dbg.c: remove unnecessary null test before debugfs_remove 2014-07-09 16:13:03 -07:00
fhci-hcd.c usb: host: drop owner assignment from platform_drivers 2014-10-20 16:21:49 +02:00
fhci-hub.c fhci-hub: use USB_DT_HUB 2015-04-03 19:03:19 +02:00
fhci-mem.c
fhci-q.c
fhci-sched.c
fhci-tds.c
fhci.h
fotg210-hcd.c usb: generic resume timeout for v4.1 2015-04-10 13:45:27 +02:00
fotg210.h fotg210: Use ehci_dbg_port struct 2014-11-07 09:02:38 -08:00
fsl-mph-dr-of.c drivers: usb: fsl: Workaround for USB erratum-A005275 2015-08-14 16:50:36 -07:00
fusbh200-hcd.c USB: fusbh200-hcd.c: move assignment out of if () block 2015-05-10 16:01:10 +02:00
fusbh200.h fusbh200: Use ehci_dbg_port struct 2014-11-07 09:02:38 -08:00
hwa-hc.c USB: HWA: fix a warning message 2014-11-03 15:26:15 -08:00
imx21-dbg.c
imx21-hcd.c imx21-hcd: use USB_DT_HUB 2015-04-03 19:03:18 +02:00
imx21-hcd.h
isp116x-hcd.c USB: isp116x-hcd.c: move assignment out of if () block 2015-05-10 16:01:11 +02:00
isp116x.h
isp1362-hcd.c isp1362-hcd: use USB_DT_HUB 2015-04-03 19:03:18 +02:00
isp1362.h
Kconfig USB: host: ohci-at91: depend on OF 2015-08-14 16:57:43 -07:00
Makefile drivers:usb:fsl:Make fsl ehci drv an independent driver module 2015-05-24 09:29:36 -07:00
max3421-hcd.c max3421-hcd: use USB_DT_HUB 2015-04-03 19:03:18 +02:00
ohci-at91.c USB: host: ohci-at91: merge loops in ohci_hcd_at91_drv_probe 2015-08-14 16:57:43 -07:00
ohci-da8xx.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ohci-dbg.c USB: ohci-dbg.c: move assignment out of if () block 2015-05-10 16:01:11 +02:00
ohci-exynos.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ohci-hcd.c USB: ohci-hcd.c: move assignment out of if () block 2015-05-10 16:01:11 +02:00
ohci-hub.c ohci-hub: use USB_DT_HUB 2015-04-03 19:03:17 +02:00
ohci-jz4740.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ohci-mem.c USB: OHCI: add I/O watchdog for orphan TDs 2014-07-18 16:34:07 -07:00
ohci-nxp.c usb: host: drop owner assignment from platform_drivers 2014-10-20 16:21:49 +02:00
ohci-omap.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ohci-omap3.c
ohci-pci.c
ohci-platform.c usb: ohci-platform: Use devm_of_phy_get_by_index 2015-05-11 21:42:25 +05:30
ohci-ppc-of.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ohci-ps3.c
ohci-pxa27x.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ohci-q.c USB: OHCI: Fix race between ED unlink and URB submission 2015-07-22 14:46:50 -07:00
ohci-s3c2410.c ohci-s3c2410: use HUB_CHAR_* 2015-01-25 21:01:13 +08:00
ohci-sa1111.c
ohci-sm501.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ohci-spear.c Driver core patches for 3.19-rc1 2014-12-14 16:10:09 -08:00
ohci-st.c usb: host: ohci-st: Add OHCI driver support for ST STB devices 2014-09-23 21:35:50 -07:00
ohci-tilegx.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
ohci-tmio.c USB: OHCI: fix bad #define in ohci-tmio.c 2015-07-22 14:49:42 -07:00
ohci.h USB: OHCI: Eliminate platform-specific test in ohci.h 2014-11-03 15:38:17 -08:00
oxu210hp-hcd.c usb: host: oxu210hp-hcd: Simplify return statement 2015-08-05 12:37:21 -07:00
oxu210hp.h
pci-quirks.c usb: host: pci_quirks: joing string literals 2015-01-31 09:05:06 -08:00
pci-quirks.h usb: pci_quirks: fix sparse 'symbol not declared' warning 2014-05-27 16:25:32 -07:00
r8a66597-hcd.c usb: generic resume timeout for v4.1 2015-04-10 13:45:27 +02:00
r8a66597.h
sl811-hcd.c usb: generic resume timeout for v4.1 2015-04-10 13:45:27 +02:00
sl811.h
sl811_cs.c
ssb-hcd.c USB: ssb: use devm_kzalloc 2015-06-08 14:26:22 -07:00
u132-hcd.c usb: host: u132-hcd: Simplify return statement 2015-08-05 12:37:21 -07:00
uhci-debug.c
uhci-grlib.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
uhci-hcd.c USB: UHCI: don't allocate frame list atomically 2014-07-09 16:16:07 -07:00
uhci-hcd.h
uhci-hub.c usb: generic resume timeout for v4.1 2015-04-10 13:45:27 +02:00
uhci-pci.c
uhci-platform.c usb: host: drop owner assignment from platform_drivers 2015-01-09 12:31:53 -08:00
uhci-q.c
xhci-dbg.c xhci: xHCI 1.1: Stopped - Short Packet Capability (SPC) 2015-08-08 15:16:00 -07:00
xhci-ext-caps.h
xhci-hub.c xhci: do not report PLC when link is in internal resume state 2015-07-22 14:19:37 -07:00
xhci-mem.c drivers/usb: Delete XHCI command timer if necessary 2015-08-03 14:41:48 -07:00
xhci-mvebu.c usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers 2014-05-27 15:40:40 -07:00
xhci-mvebu.h usb: host: xhci-plat: add support for the Armada 375/38x XHCI controllers 2014-05-27 15:40:40 -07:00
xhci-pci.c xhci: Move xhci_pme_quirk() behind #ifdef CONFIG_PM 2015-09-21 22:48:53 -07:00
xhci-plat.c usb: xhci: Fix suspend/resume when used with OTG core 2015-05-31 15:45:31 +09:00
xhci-rcar.c usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers 2014-07-09 15:49:10 -07:00
xhci-rcar.h usb: host: xhci-plat: add support for the R-Car H2 and M2 xHCI controllers 2014-07-09 15:49:10 -07:00
xhci-ring.c xhci: give command abortion one more chance before killing xhci 2015-09-21 22:48:53 -07:00
xhci-trace.c xhci: Export symbols used by host-controller drivers 2014-10-03 14:44:45 -07:00
xhci-trace.h tracing: Add TRACE_SYSTEM_VAR to xhci-hcd 2015-04-07 12:31:55 -04:00
xhci.c usb: xhci: exit early in xhci_setup_device() if we're halted or dying 2015-09-21 22:50:44 -07:00
xhci.h xhci: xHCI 1.1: Stopped - Short Packet Capability (SPC) 2015-08-08 15:16:00 -07:00