linux/drivers/usb/host
Tony Camuso 77df9e0b79 xhci - correct comp_mode_recovery_timer on return from hibernate
Commit 71c731a2 (usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP
Hardware) was a workaround for systems using the SN65LVPE502CP,
controller, but it introduced a bug in resume from hibernate.

The fix created a timer, comp_mode_recovery_timer, which is deleted from
a timer list when xhci_suspend() is called. However, the hibernate image,
including the timer list containing the comp_mode_recovery_timer, had
already been saved before the timer was deleted.

Upon resume from hibernate, the list containing the comp_mode_recovery_timer
is restored from the image saved to disk, and xhci_resume(), assuming that
the timer had been deleted by xhci_suspend(), makes a call to
compliance_mode_recoery_timer_init(), which creates a new instance of the
comp_mode_recovery_timer and attempts to place it into the same list in which
it is already active, thus corrupting the list during the list_add() call.

At this point, a call trace is emitted indicating the list corruption.
Soon afterward, the system locks up, the watchdog times out, and the
ensuing NMI crashes the system.

The problem did not occur when resuming from suspend. In suspend, the
image in RAM remains exactly as it was when xhci_suspend() deleted the
comp_mode_recovery_timer, so there is no problem when xhci_resume()
creates a new instance of this timer and places it in the still empty
list.

This patch avoids the problem by deleting the timer in xhci_resume()
when resuming from hibernate. Now xhci_resume() can safely make the
call to create a new instance of this timer, whether returning from
suspend or hibernate.

Thanks to Alan Stern for his help with understanding the problem.

[Sarah reworked this patch to cover the case where the xHCI restore
register operation fails, and (temp & STS_SRE) is true (and we re-init
the host, including re-init for the compliance mode), but hibernate is
false.  The original patch would have caused list corruption in this
case.]

This patch should be backported to kernels as old as 3.2, that
contain the commit 71c731a296 "usb: host:
xhci: Fix Compliance Mode on SN65LVPE502CP Hardware"

Signed-off-by: Tony Camuso <tcamuso@redhat.com>
Tested-by: Tony Camuso <tcamuso@redhat.com>
Acked-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Cc: stable@vger.kernel.org
2013-05-24 15:23:39 -07:00
..
whci USB: whci-hcd: fix NULL dereference on allocation failure 2012-08-15 15:17:39 -07:00
bcma-hcd.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
ehci-atmel.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ehci-dbg.c USB: EHCI: convert singly-linked lists to list_heads 2013-03-25 13:35:05 -07:00
ehci-fsl.c EHCI: Quirk flag for port power handling on overcurrent. 2013-04-03 11:38:53 -07:00
ehci-fsl.h powerpc/usb: fix bug of CPU hang when missing USB PHY clock 2012-09-05 16:52:08 -07:00
ehci-grlib.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ehci-hcd.c USB: EHCI: remove bogus #error 2013-05-16 17:29:51 -07:00
ehci-hub.c EHCI: Quirk flag for port power handling on overcurrent. 2013-04-03 11:38:53 -07:00
ehci-mem.c USB: EHCI: use hrtimer for (s)iTD deallocation 2012-07-16 16:54:25 -07:00
ehci-msm.c USB: EHCI: make ehci-msm a separate driver 2013-04-08 09:40:20 -07:00
ehci-mv.c usb: patches for v3.10 merge window 2013-04-05 15:18:00 -07:00
ehci-mxc.c USB: Fix initconst in ehci driver 2013-04-23 10:10:29 -07:00
ehci-octeon.c USB: EHCI: remove ehci_port_power() routine 2012-10-31 12:48:07 -07:00
ehci-omap.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ehci-orion.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ehci-pci.c USB: Fix initconst in ehci driver 2013-04-23 10:10:29 -07:00
ehci-platform.c USB: Fix initconst in ehci driver 2013-04-23 10:10:29 -07:00
ehci-pmcmsp.c USB: EHCI: remove ehci_port_power() routine 2012-10-31 12:48:07 -07:00
ehci-ppc-of.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ehci-ps3.c usb: PS3 EHCI remove unneeded ehci_shutdown 2013-04-01 12:32:43 -07:00
ehci-q.c usb: ehci: mark unlink_empty_async_suspended() as __maybe_unused 2013-03-28 14:49:53 -07:00
ehci-s5p.c usb: ehci-s5p: fix memleak when fallback to pdata 2013-05-16 17:35:13 -07:00
ehci-sched.c Merge branch 'usb-linus' into usb-next 2013-03-28 11:00:55 -07:00
ehci-sead3.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ehci-sh.c usb: echi-sh: Remove driver variable which is not used 2013-03-28 11:14:47 -07:00
ehci-spear.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ehci-sysfs.c
ehci-tegra.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ehci-tilegx.c usb: tilegx: fix memleak when create hcd fail 2013-05-09 13:56:40 -04:00
ehci-timer.c USB: EHCI: improve end_unlink_async() 2013-03-25 13:36:32 -07:00
ehci-w90x900.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
ehci-xilinx-of.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ehci.h EHCI: Quirk flag for port power handling on overcurrent. 2013-04-03 11:38:53 -07:00
fhci-dbg.c
fhci-hcd.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
fhci-hub.c
fhci-mem.c
fhci-q.c
fhci-sched.c USB: FHCI: use list_move_tail instead of list_del/list_add_tail 2012-09-05 16:55:18 -07:00
fhci-tds.c
fhci.h
fsl-mph-dr-of.c USB: fsl-mph-dr-of: fix regression on mpc5121e 2013-01-11 16:01:06 -08:00
hwa-hc.c
imx21-dbg.c
imx21-hcd.c usb: imx21-hcd: Include missing linux/module.h 2013-01-11 12:01:09 -08:00
imx21-hcd.h ARM: imx: move platform_data definitions 2012-09-14 11:17:21 +02:00
isp116x-hcd.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
isp116x.h
isp1362-hcd.c procfs: new helper - PDE_DATA(inode) 2013-04-09 14:13:32 -04:00
isp1362.h
isp1760-hcd.c USB: remove remaining instances of USB_SUSPEND 2013-05-15 13:44:44 -04:00
isp1760-hcd.h
isp1760-if.c usb: isp1760-if: fix memleak when platform_get_resource fail 2013-05-16 17:35:13 -07:00
Kconfig USB: fix Kconfig logic for USB_UHCI_HCD 2013-05-15 13:41:39 -04:00
Makefile USB: EHCI: make ehci-msm a separate driver 2013-04-08 09:40:20 -07:00
octeon2-common.c
ohci-at91.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ohci-da8xx.c ARM: davinci: move platform_data definitions 2012-09-14 11:16:54 +02:00
ohci-dbg.c
ohci-ep93xx.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-exynos.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ohci-hcd.c USB: OHCI: fix logic for scheduling isochronous URBs 2013-05-15 13:42:45 -04:00
ohci-hub.c USB: remove CONFIG_USB_SUSPEND option 2013-03-28 11:10:22 -07:00
ohci-jz4740.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
ohci-mem.c
ohci-nxp.c usb: ohci: fix goto wrong tag in err case 2013-05-16 17:37:20 -07:00
ohci-octeon.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-omap3.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ohci-omap.c ARM: arm-soc: Header cleanups 2012-12-12 11:45:16 -08:00
ohci-pci.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-platform.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ohci-ppc-of.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-ps3.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-pxa27x.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ohci-q.c USB: ohci: set urb->hcpriv = NULL immediately, after free it 2013-01-11 16:03:38 -08:00
ohci-s3c2410.c usb: Convert to devm_ioremap_resource() 2013-01-22 11:41:58 -08:00
ohci-sa1111.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
ohci-sm501.c USB: OHCI: sm501: fix build failure after ohci_finish_controller_resume removal 2012-10-23 10:18:53 -07:00
ohci-spear.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ohci-tilegx.c usb: tilegx: fix memleak when create hcd fail 2013-05-09 13:56:40 -04:00
ohci-tmio.c usb: host: ohci-tmio: fix compile warning 2013-01-11 16:22:53 -08:00
ohci.h
oxu210hp-hcd.c USB: remove remaining instances of USB_SUSPEND 2013-05-15 13:44:44 -04:00
oxu210hp.h
pci-quirks.c usb: Prevent dead ports when xhci is not enabled 2013-01-24 09:56:19 -08:00
pci-quirks.h usb: host: xhci: fix compilation error for non-PCI based stacks 2012-09-05 12:26:11 -07:00
r8a66597-hcd.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
r8a66597.h usb/host/r8a66597: remove conditional compilation of clk code 2012-07-30 17:25:12 -07:00
sl811_cs.c drivers/usb: use module_pcmcia_driver() in pcmcia drivers 2013-03-15 12:26:38 -07:00
sl811-hcd.c USB: remove remaining instances of USB_SUSPEND 2013-05-15 13:44:44 -04:00
sl811.h
ssb-hcd.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
u132-hcd.c USB: remove CONFIG_USB_SUSPEND option 2013-03-28 11:10:22 -07:00
uhci-debug.c USB: uhci: beautify source code 2013-01-24 13:59:26 -08:00
uhci-grlib.c usb: remove use of __devinit 2012-11-21 13:27:16 -08:00
uhci-hcd.c Merge 3.8-rc5 into usb-next 2013-01-25 12:41:02 -08:00
uhci-hcd.h USB: UHCI: remove unused definition 2013-01-24 13:42:09 -08:00
uhci-hub.c USB: UHCI: fix for suspend of virtual HP controller 2013-05-15 13:41:40 -04:00
uhci-pci.c
uhci-platform.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
uhci-q.c USB: fix latency in uhci-hcd and ohci-hcd 2013-05-15 13:42:45 -04:00
xhci-dbg.c xhci: trivial: Remove assigned but unused slot_ctx. 2012-10-25 13:13:48 -07:00
xhci-ext-caps.h
xhci-hub.c USB: remove CONFIG_USB_SUSPEND option 2013-03-28 11:10:22 -07:00
xhci-mem.c xhci: fix list access before init 2013-05-24 09:14:47 -07:00
xhci-pci.c usb: add find_raw_port_number callback to struct hc_driver() 2013-03-25 10:39:17 -07:00
xhci-plat.c usb: host: xhci-plat: use ioremap_nocache 2012-09-05 12:07:19 -07:00
xhci-ring.c xhci: Don't warn on empty ring for suspended devices. 2013-03-25 10:39:19 -07:00
xhci.c xhci - correct comp_mode_recovery_timer on return from hibernate 2013-05-24 15:23:39 -07:00
xhci.h xhci: Rename SEGMENT_SIZE and SEGMENT_SHIFT as the former is used in a.out.h 2013-04-03 10:28:33 -07:00