linux/drivers/usb/host
Mathias Nyman d3519b9d96 xhci: Manually give back cancelled URB if we can't queue it for cancel
xhci needs to take care of four scenarios when asked to cancel a URB.

1 URB is not queued or already given back.
  usb_hcd_check_unlink_urb() will return an error, we pass the error on

2 We fail to find xhci internal structures from urb private data such as
  virtual device and endpoint ring.
  Give back URB immediately, can't do anything about internal structures.

3 URB private data has valid pointers to xhci internal data, but host is
  not  responding.
  give back URB immedately and remove the URB from the endpoint lists.

4 Everyting is working
  add URB to cancel list, queue a command to stop the endpoint, after
  which the URB can be turned to no-op or skipped, removed from lists,
  and given back.

We failed to give back the urb in case 2 where the correct device and
endpoint pointers could not be retrieved from URB private data.

This caused a hang on Dell Inspiron 5558/0VNM2T at resume from suspend
as urb was never returned.

[  245.270505] INFO: task rtsx_usb_ms_1:254 blocked for more than 120 seconds.
[  245.272244]       Tainted: G        W       4.11.0-rc3-ARCH #2
[  245.273983] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[  245.275737] rtsx_usb_ms_1   D    0   254      2 0x00000000
[  245.277524] Call Trace:
[  245.279278]  __schedule+0x2d3/0x8a0
[  245.281077]  schedule+0x3d/0x90
[  245.281961]  usb_kill_urb.part.3+0x6c/0xa0 [usbcore]
[  245.282861]  ? wake_atomic_t_function+0x60/0x60
[  245.283760]  usb_kill_urb+0x21/0x30 [usbcore]
[  245.284649]  usb_start_wait_urb+0xe5/0x170 [usbcore]
[  245.285541]  ? try_to_del_timer_sync+0x53/0x80
[  245.286434]  usb_bulk_msg+0xbd/0x160 [usbcore]
[  245.287326]  rtsx_usb_send_cmd+0x63/0x90 [rtsx_usb]

Reported-by: diego.viola@gmail.com
Tested-by: diego.viola@gmail.com
Cc: stable@vger.kernel.org
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-29 12:13:49 +02:00
..
whci whci: Remove deprecated create_singlethread_workqueue 2016-08-15 16:25:58 +02:00
bcma-hcd.c USB: bcma: drop Northstar PHY 2.0 initialization code 2016-09-27 12:20:17 +02:00
ehci-atmel.c usb: ehci-atmel: use __maybe_unused to hide pm functions 2016-03-03 20:37:41 -08:00
ehci-dbg.c USB: EHCI: make all debugging depend on CONFIG_DYNAMIC_DEBUG 2016-04-29 15:31:30 -07:00
ehci-exynos.c usb: host: ehci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths 2017-01-10 17:00:42 +01:00
ehci-fsl.c usb: host: constify dev_pm_ops structures 2017-01-19 10:34:45 +01: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
ehci-hcd.c lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
ehci-hub.c fsl/usb: Workarourd for USB erratum-A005697 2016-12-05 15:13:58 +01:00
ehci-mem.c USB-EHCI: Delete unnecessary checks before the function call "dma_pool_destroy" 2015-12-01 14:26:33 -08:00
ehci-msm.c usb: host: ehci-msm: Conditionally call ehci suspend/resume 2016-06-07 22:15:25 -07:00
ehci-mv.c
ehci-mxc.c
ehci-omap.c usb/host/: const data must use __initconst not __initdata 2016-04-28 12:35:36 -07:00
ehci-orion.c usb: ehci-orion: fix probe for !GENERIC_PHY 2015-10-04 10:45:08 +01:00
ehci-pci.c USB: EHCI: merge all cases that disable the IO watchdog 2016-10-24 14:36:25 +02:00
ehci-platform.c usb: ehci-platform: increase EHCI_MAX_RSTS to 4 2016-10-24 14:29:08 +02:00
ehci-pmcmsp.c
ehci-ppc-of.c
ehci-ps3.c
ehci-q.c usb: host: ehci: remove unnecessary max_packet() macro 2016-11-03 10:38:24 +02:00
ehci-sched.c usb: host: ehci: remove unnecessary max_packet() macro 2016-11-03 10:38:24 +02:00
ehci-sh.c
ehci-spear.c usb/host/: const data must use __initconst not __initdata 2016-04-28 12:35:36 -07:00
ehci-st.c usb: host: ehci-st: Inform the reset framework that our reset line may be shared 2016-06-30 07:44:21 +01: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: host: ehci-tegra: Avoid getting the same reset twice 2016-06-07 22:15:25 -07:00
ehci-tilegx.c
ehci-timer.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
ehci-w90x900.c USB: EHCI: ehci-w90x900: remove unuseful functions 2016-11-29 17:36:43 +01:00
ehci-xilinx-of.c
ehci.h fsl/usb: Workarourd for USB erratum-A005697 2016-12-05 15:13:58 +01:00
fhci-dbg.c
fhci-hcd.c usb: host: fhci-hcd: don't print on ENOMEM 2016-08-30 19:17:37 +02:00
fhci-hub.c QE: Move QE from arch/powerpc to drivers/soc 2015-12-22 17:12:56 -06:00
fhci-mem.c
fhci-q.c
fhci-sched.c USB: FHCI: avoid redundant condition 2016-05-09 13:08:46 +02:00
fhci-tds.c usb: whci: fhci: remove comparison to bool 2015-12-04 08:25:58 -08:00
fhci.h QE: Move QE from arch/powerpc to drivers/soc 2015-12-22 17:12:56 -06:00
fotg210-hcd.c lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
fotg210.h usb/host/fotg210: Fix coding style issues 2015-10-16 23:46:22 -07:00
fsl-mph-dr-of.c fsl/usb: Workarourd for USB erratum-A005697 2016-12-05 15:13:58 +01:00
hwa-hc.c
imx21-dbg.c
imx21-hcd.c
imx21-hcd.h
isp116x-hcd.c
isp116x.h
isp1362-hcd.c usb: Convert pr_warning to pr_warn 2016-11-03 10:38:36 +02:00
isp1362.h
Kconfig usb: make the MTK XHCI driver compile for older MIPS SoCs 2017-01-10 17:00:41 +01:00
Makefile USB: OHCI: make ohci-da8xx a separate driver 2016-10-27 16:59:59 +02:00
max3421-hcd.c usb: host: max3421-hcd: don't print on ENOMEM 2016-08-30 19:17:37 +02:00
ohci-at91.c usb: ohci-at91: Do not drop unhandled USB suspend control requests 2017-03-09 10:22:08 +01:00
ohci-da8xx.c USB: ohci: da8xx: Resume the entire host controller 2016-11-29 17:31:36 +01:00
ohci-dbg.c
ohci-exynos.c usb: host: ohci-exynos: Decrese node refcount on exynos_ehci_get_phy() error paths 2017-01-10 17:00:42 +01:00
ohci-hcd.c lib/vsprintf.c: remove %Z support 2017-02-27 18:43:47 -08:00
ohci-hub.c ohci-hub: fix typo in dbg_port macro 2017-02-10 12:20:57 +01:00
ohci-mem.c USB: OHCI: use dma_pool_zalloc 2016-11-21 17:33:40 +01:00
ohci-nxp.c USB: OHCI: nxp: fix code warnings 2016-12-08 17:50:09 +01:00
ohci-omap3.c
ohci-omap.c USB: ohci-omap: defer probe if PHY is missing 2017-01-10 17:00:41 +01:00
ohci-pci.c
ohci-platform.c ohci-platform: Add support for controllers with multiple reset lines 2016-06-07 22:21:41 -07:00
ohci-ppc-of.c
ohci-ps3.c
ohci-pxa27x.c USB: OHCI: ohci-pxa27x: remove useless functions 2016-12-05 16:32:51 +01:00
ohci-q.c USB: OHCI: Don't mark EDs as ED_OPER if scheduling fails 2016-06-07 22:15:25 -07:00
ohci-s3c2410.c USB: OHCI: ohci-s3c2410: remove useless functions 2016-12-05 16:32:51 +01:00
ohci-sa1111.c usb: ohci-sa1111: remove mach/hardware.h include 2016-08-30 19:24:59 +02:00
ohci-sm501.c
ohci-spear.c usb: host: ohci-spear: Fix module autoload for OF platform driver 2015-10-04 10:51:58 +01:00
ohci-st.c usb: host: ohci-st: Inform the reset framework that our reset line may be shared 2016-06-30 07:44:20 +01:00
ohci-tilegx.c
ohci-tmio.c USB: OHCI: fix bad #define in ohci-tmio.c 2015-07-22 14:49:42 -07:00
ohci.h usb: host: unhide suspend/resume declarations 2016-03-03 20:37:41 -08:00
oxu210hp-hcd.c usb: host: oxu210hp-hcd: remove unused variable 2017-01-19 10:34:41 +01:00
oxu210hp.h
pci-quirks.c drivers/usb: Skip auto handoff for TI and RENESAS usb controllers 2016-11-07 10:12:22 +01:00
pci-quirks.h
r8a66597-hcd.c usb: r8a66597: add locking to r8a66597_check_detect_child 2016-02-06 21:55:57 -08:00
r8a66597.h
sl811_cs.c
sl811-hcd.c
sl811.h
ssb-hcd.c
u132-hcd.c usb: host: u132-hcd: use list_for_each_entry 2016-01-24 20:55:33 -08:00
uhci-debug.c new helpers: no_seek_end_llseek{,_size}() 2015-12-23 10:41:31 -05:00
uhci-grlib.c
uhci-hcd.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
uhci-hcd.h
uhci-hub.c
uhci-pci.c USB: UHCI: report non-PME wakeup signalling for Intel hardware 2016-11-11 16:32:35 -06:00
uhci-platform.c usb: host: uhci-platform: Fix module autoload for OF platform driver 2015-10-04 10:51:58 +01:00
uhci-q.c usb : replace dma_pool_alloc and memset with dma_pool_zalloc 2015-12-01 14:26:33 -08:00
xhci-dbg.c usb: host: xhci-dbg: HCIVERSION should be a binary number 2017-03-09 18:00:39 +01:00
xhci-ext-caps.h usb: host: xhci: remove unneded semicolon 2017-01-25 10:59:06 +01:00
xhci-hub.c usb: host: xhci: add xhci_virt_device tracer 2017-01-25 11:00:01 +01:00
xhci-mem.c xhci: simplify how we store TDs in urb private data 2017-01-25 11:00:02 +01:00
xhci-mtk-sch.c usb: host: xhci: purge GET_MAX_PACKET() 2016-11-03 10:38:22 +02:00
xhci-mtk.c usb: xhci: remove dummy extra_priv_size for size of xhci_hcd struct 2017-03-09 18:00:39 +01:00
xhci-mtk.h usb: xhci-mtk: add reference clock 2017-01-19 10:37:16 +01:00
xhci-mvebu.c usb: host: xhci: plat: change type of mvebu init_quirk() 2016-04-26 16:08:02 -07:00
xhci-mvebu.h usb: host: xhci: plat: change type of mvebu init_quirk() 2016-04-26 16:08:02 -07:00
xhci-pci.c usb: xhci: remove unnecessary return in xhci_pci_setup() 2017-01-25 10:57:35 +01:00
xhci-plat.c xhci: plat: Register shutdown for xhci_plat 2017-03-29 12:13:49 +02:00
xhci-plat.h usb: host: xhci: plat: finally get rid of xhci_plat_type_is() 2016-04-26 16:08:02 -07:00
xhci-rcar.c usb: host: xhci: plat: add support for Renesas r8a7796 SoC 2016-11-14 10:18:22 +01:00
xhci-rcar.h usb: host: xhci: rcar: add a new firmware version for r8a7796 2016-11-14 10:18:22 +01:00
xhci-ring.c xhci: Set URB actual length for stopped control transfers 2017-03-29 12:13:49 +02:00
xhci-tegra.c usb: xhci: remove dummy extra_priv_size for size of xhci_hcd struct 2017-03-09 18:00:39 +01:00
xhci-trace.c
xhci-trace.h usb: host: xhci: add xhci_virt_device tracer 2017-01-25 11:00:01 +01:00
xhci.c xhci: Manually give back cancelled URB if we can't queue it for cancel 2017-03-29 12:13:49 +02:00
xhci.h xhci: simplify how we store TDs in urb private data 2017-01-25 11:00:02 +01:00