stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Tony Camuso <tcamuso@redhat.com>, Don Zickus <dzickus@redhat.com>,
	Sarah Sharp <sarah.a.sharp@linux.intel.com>
Subject: [068/141] xhci - correct comp_mode_recovery_timer on return from hibernate
Date: Wed, 03 Jul 2013 14:40:05 -0400	[thread overview]
Message-ID: <20130703184055.903429244@goodmis.org> (raw)
In-Reply-To: 20130703183857.307196999@goodmis.org

[-- Attachment #1: 0068-xhci-correct-comp_mode_recovery_timer-on-return-from.patch --]
[-- Type: text/plain, Size: 4463 bytes --]

3.6.11.6 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Tony Camuso <tcamuso@redhat.com>

[ Upstream commit 77df9e0b799b03e1d5d9c68062709af5f637e834 ]

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 71c731a296f1b08a3724bd1b514b64f1bda87a23 "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
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 drivers/usb/host/xhci.c |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index fd36acd..6ee481a 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -942,6 +942,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 	struct usb_hcd		*hcd = xhci_to_hcd(xhci);
 	struct usb_hcd		*secondary_hcd;
 	int			retval = 0;
+	bool			comp_timer_running = false;
 
 	/* Wait a bit if either of the roothubs need to settle from the
 	 * transition into bus suspend.
@@ -979,6 +980,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 
 	/* If restore operation fails, re-initialize the HC during resume */
 	if ((temp & STS_SRE) || hibernated) {
+
+		if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) &&
+				!(xhci_all_ports_seen_u0(xhci))) {
+			del_timer_sync(&xhci->comp_mode_recovery_timer);
+			xhci_dbg(xhci, "Compliance Mode Recovery Timer deleted!\n");
+		}
+
 		/* Let the USB core know _both_ roothubs lost power. */
 		usb_root_hub_lost_power(xhci->main_hcd->self.root_hub);
 		usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub);
@@ -1021,6 +1029,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		retval = xhci_init(hcd->primary_hcd);
 		if (retval)
 			return retval;
+		comp_timer_running = true;
+
 		xhci_dbg(xhci, "Start the primary HCD\n");
 		retval = xhci_run(hcd->primary_hcd);
 		if (!retval) {
@@ -1062,7 +1072,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 	 * to suffer the Compliance Mode issue again. It doesn't matter if
 	 * ports have entered previously to U0 before system's suspension.
 	 */
-	if (xhci->quirks & XHCI_COMP_MODE_QUIRK)
+	if ((xhci->quirks & XHCI_COMP_MODE_QUIRK) && !comp_timer_running)
 		compliance_mode_recovery_timer_init(xhci);
 
 	return retval;
-- 
1.7.10.4



  parent reply	other threads:[~2013-07-03 18:40 UTC|newest]

Thread overview: 143+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-03 18:38 [000/141] 3.6.11.6-stable review Steven Rostedt
2013-07-03 18:38 ` [001/141] avr32: fix relocation check for signed 18-bit offset Steven Rostedt
2013-07-03 18:38 ` [002/141] ARM: plat-orion: Fix num_resources and id for ge10 and ge11 Steven Rostedt
2013-07-03 18:39 ` [003/141] cfg80211: fix wiphy_register error path Steven Rostedt
2013-07-03 18:39 ` [004/141] mac80211: fix AP-mode frame matching Steven Rostedt
2013-07-03 18:39 ` [005/141] usb: option: Add Telewell TW-LTE 4G Steven Rostedt
2013-07-03 18:39 ` [006/141] USB: option: add device IDs for Dell 5804 (Novatel E371) WWAN card Steven Rostedt
2013-07-03 18:39 ` [007/141] USB: ftdi_sio: Add support for Newport CONEX motor drivers Steven Rostedt
2013-07-03 18:39 ` [008/141] USB: cxacru: potential underflow in cxacru_cm_get_array() Steven Rostedt
2013-07-03 18:39 ` [009/141] TTY: Fix tty miss restart after we turn off flow-control Steven Rostedt
2013-07-03 18:39 ` [010/141] USB: Blacklisted Cinterions PLxx WWAN Interface Steven Rostedt
2013-07-03 18:39 ` [011/141] USB: reset resume quirk needed by a hub Steven Rostedt
2013-07-03 18:39 ` [012/141] USB: xHCI: override bogus bulk wMaxPacketSize values Steven Rostedt
2013-07-03 18:39 ` [013/141] USB: UHCI: fix for suspend of virtual HP controller Steven Rostedt
2013-07-03 18:39 ` [014/141] Input: egalax_ts - ABS_MT_POSITION_Y not reported well Steven Rostedt
2013-07-03 18:39 ` [015/141] cifs: only set ops for inodes in I_NEW state Steven Rostedt
2013-07-03 18:39 ` [016/141] random: fix accounting race condition with lockless irq entropy_count update Steven Rostedt
2013-07-03 18:39 ` [017/141] fat: fix possible overflow for fat_clusters Steven Rostedt
2013-07-03 18:39 ` [018/141] tg3: Skip powering down function 0 on certain serdes devices Steven Rostedt
2013-07-03 18:39 ` [019/141] tg3: Fix data corruption on 5725 with TSO Steven Rostedt
2013-07-03 18:39 ` [020/141] perf: net_dropmonitor: Fix trace parameter order Steven Rostedt
2013-07-03 18:39 ` [021/141] perf: net_dropmonitor: Fix symbol-relative addresses Steven Rostedt
2013-07-03 18:39 ` [022/141] ocfs2: goto out_unlock if ocfs2_get_clusters_nocache() failed in ocfs2_fiemap() Steven Rostedt
2013-07-03 18:39 ` [023/141] Kirkwood: Enable PCIe port 1 on QNAP TS-11x/TS-21x Steven Rostedt
2013-07-03 18:39 ` [024/141] drivers/leds/leds-ot200.c: fix error caused by shifted mask Steven Rostedt
2013-07-03 18:39 ` [025/141] rapidio/tsi721: fix bug in MSI interrupt handling Steven Rostedt
2013-07-03 18:39 ` [026/141] mm compaction: fix of improper cache flush in migration code Steven Rostedt
2013-07-03 18:39 ` [027/141] wait: fix false timeouts when using wait_event_timeout() Steven Rostedt
2013-07-03 18:39 ` [028/141] nilfs2: fix issue of nilfs_set_page_dirty() for page at EOF boundary Steven Rostedt
2013-07-03 18:39 ` [029/141] mm: memcg: remove incorrect VM_BUG_ON for swap cache pages in uncharge Steven Rostedt
2013-07-03 18:39 ` [030/141] drivers/block/brd.c: fix brd_lookup_page() race Steven Rostedt
2013-07-03 18:39 ` [031/141] mm/pagewalk.c: walk_page_range should avoid VM_PFNMAP areas Steven Rostedt
2013-07-03 18:39 ` [032/141] mm/THP: use pmd_populate() to update the pmd with pgtable_t pointer Steven Rostedt
2013-07-03 18:39 ` [033/141] xfs: kill suid/sgid through the truncate path Steven Rostedt
2013-07-03 18:39 ` [034/141] SUNRPC: Prevent an rpc_task wakeup race Steven Rostedt
2013-07-03 18:39 ` [035/141] ASoC: cs42l52: fix default value for MASTERA_VOL Steven Rostedt
2013-07-03 18:39 ` [036/141] drm/radeon: fix typo in cu_per_sh on verde Steven Rostedt
2013-07-03 18:39 ` [037/141] drm/radeon: fix card_posted check for newer asics Steven Rostedt
2013-07-03 18:39 ` [038/141] cifs: fix potential buffer overrun when composing a new options string Steven Rostedt
2013-07-03 18:39 ` [039/141] ata_piix: add PCI IDs for Intel BayTail Steven Rostedt
2013-07-03 18:39 ` [040/141] libata: make ata_exec_internal_sg honor DMADIR Steven Rostedt
2013-07-03 18:39 ` [041/141] m68k/mac: Fix unexpected interrupt with CONFIG_EARLY_PRINTK Steven Rostedt
2013-07-03 18:39 ` [042/141] iscsi-target: fix heap buffer overflow on error Steven Rostedt
2013-07-03 18:39 ` [043/141] ib_srpt: Call target_sess_cmd_list_set_waiting during shutdown_session Steven Rostedt
2013-07-03 18:39 ` [044/141] NFSv4: Fix a thinko in nfs4_try_open_cached Steven Rostedt
2013-07-03 18:39 ` [045/141] regulator: palmas: Fix "enable_reg" to point to the correct reg for SMPS10 Steven Rostedt
2013-07-03 18:39 ` [046/141] reiserfs: fix deadlock with nfs racing on create/lookup Steven Rostedt
2013-07-03 18:39 ` [047/141] reiserfs: fix problems with chowning setuid file w/ xattrs Steven Rostedt
2013-07-03 18:39 ` [048/141] reiserfs: fix spurious multiple-fill in reiserfs_readdir_dentry Steven Rostedt
2013-07-03 18:39 ` [049/141] jfs: fix a couple races Steven Rostedt
2013-07-03 18:39 ` [050/141] xen-netback: remove skb in xen_netbk_alloc_page Steven Rostedt
2013-07-03 18:39 ` [051/141] iommu/amd: Re-enable IOMMU event log interrupt after handling Steven Rostedt
2013-07-03 18:39 ` [052/141] iommu/amd: Workaround for ERBT1312 Steven Rostedt
2013-07-03 18:39 ` [053/141] ACPI / video: Add "Asus UL30A" to ACPI video detect blacklist Steven Rostedt
2013-07-03 18:39 ` [054/141] mac80211: close AP_VLAN interfaces before unregistering all Steven Rostedt
2013-07-03 18:39 ` [055/141] iwlwifi: dvm: fix zero LQ CMD sending avoidance Steven Rostedt
2013-07-03 18:39 ` [056/141] cfg80211: check wdev->netdev in connection work Steven Rostedt
2013-07-03 18:39 ` [057/141] ath9k: use correct OTP register offsets for AR9550 Steven Rostedt
2013-07-03 18:39 ` [058/141] tg3: Add read dma workaround for 5720 Steven Rostedt
2013-07-03 18:39 ` [059/141] target: Re-instate sess_wait_list for target_wait_for_sess_cmds Steven Rostedt
2013-07-03 18:39 ` [060/141] xen-netback: coalesce slots in TX path and fix regressions Steven Rostedt
2013-07-03 18:39 ` [061/141] xen-netback: dont disconnect frontend when seeing oversize packet Steven Rostedt
2013-07-03 18:39 ` [062/141] xen-netback: remove redundent parameter in netbk_count_requests Steven Rostedt
2013-07-03 18:40 ` [063/141] xen-netback: avoid allocating variable size array on stack Steven Rostedt
2013-07-03 18:40 ` [064/141] xen-netfront: reduce gso_max_size to account for max TCP header Steven Rostedt
2013-07-03 18:40 ` [065/141] xen-netback: better names for thresholds Steven Rostedt
2013-07-03 18:40 ` [066/141] USB: serial: Add Option GTM681W to qcserial device table Steven Rostedt
2013-07-03 18:40 ` [067/141] USB: option: blacklist network interface on Huawei E1820 Steven Rostedt
2013-07-03 18:40 ` Steven Rostedt [this message]
2013-07-03 18:40 ` [069/141] xhci-mem: init list heads at the beginning of init Steven Rostedt
2013-07-03 18:40 ` [070/141] xhci: fix list access before init Steven Rostedt
2013-07-03 18:40 ` [071/141] xhci: Disable D3cold for buggy TI redrivers Steven Rostedt
2013-07-03 18:40 ` [072/141] ALSA: usb-audio: fix Roland/Cakewalk UM-3G support Steven Rostedt
2013-07-03 18:40 ` [073/141] ALSA: usb-audio - Apply Logitech QuickCam Pro 9000 quirk only to audio iface Steven Rostedt
2013-07-03 18:40 ` [074/141] ALSA: usb-audio - Fix invalid volume resolution on Logitech HD webcam c270 Steven Rostedt
2013-07-03 18:40 ` [075/141] USB: iuu_phoenix: fix bulk-message timeout Steven Rostedt
2013-07-03 18:40 ` [076/141] USB: keyspan: fix bogus array index Steven Rostedt
2013-07-03 18:40 ` [077/141] USB: ark3116: fix control-message timeout Steven Rostedt
2013-07-03 18:40 ` [078/141] USB: visor: fix initialisation of Treo/Kyocera devices Steven Rostedt
2013-07-03 18:40 ` [079/141] USB: Serial: cypress_M8: Enable FRWD Dongle hidcom device Steven Rostedt
2013-07-03 18:40 ` [080/141] USB: whiteheat: fix broken port configuration Steven Rostedt
2013-07-03 18:40 ` [081/141] USB: serial: fix Treo/Kyocera interrrupt-in urb context Steven Rostedt
2013-07-03 18:40 ` [082/141] USB: mos7840: fix DMA to stack Steven Rostedt
2013-07-03 18:40 ` [083/141] USB: mos7720: " Steven Rostedt
2013-07-03 18:40 ` [084/141] USB: mos7720: fix message timeouts Steven Rostedt
2013-07-03 18:40 ` [085/141] USB: mos7720: fix hardware flow control Steven Rostedt
2013-07-03 18:40 ` [086/141] ACPI / video: ignore BIOS initial backlight value for HP m4 Steven Rostedt
2013-07-03 18:40 ` [087/141] ACPI / video: ignore BIOS initial backlight value for HP Pavilion g6 Steven Rostedt
2013-07-03 18:40 ` [088/141] ARM: 7742/1: topology: export cpu_topology Steven Rostedt
2013-07-03 18:40 ` [089/141] ARM: 7743/1: compressed/head.S: work around new binutils warning Steven Rostedt
2013-07-03 18:40 ` [090/141] powerpc/eeh: Dont check RTAS token to get PE addr Steven Rostedt
2013-07-03 18:40 ` [091/141] dmaengine: ste_dma40: fix pm runtime ref counting Steven Rostedt
2013-07-03 18:40 ` [092/141] radeon: Fix system hang issue when using KMS with older cards Steven Rostedt
2013-07-03 18:40 ` [093/141] drm/radeon: dont allow audio on DCE6 Steven Rostedt
2013-07-03 18:40 ` [094/141] ecryptfs: fixed msync to flush data Steven Rostedt
2013-07-03 18:40 ` [095/141] eCryptfs: Check return of filemap_write_and_wait during fsync Steven Rostedt
2013-07-03 18:40 ` [096/141] hwmon: (adm1021) Strengthen chip detection for ADM1021, LM84 and MAX1617 Steven Rostedt
2013-07-03 18:40 ` [097/141] drm/mgag200: Add missing write to index before accessing data register Steven Rostedt
2013-07-03 18:40 ` [098/141] drm: fix a use-after-free when GPU acceleration disabled Steven Rostedt
2013-07-03 18:40 ` [099/141] drm/i915/sdvo: Use &intel_sdvo->ddc instead of intel_sdvo->i2c for DDC Steven Rostedt
2013-07-03 18:40 ` [100/141] drm/i915: no lvds quirk for hp t5740 Steven Rostedt
2013-07-03 18:40 ` [101/141] usb: dwc3: gadget: free trb pool only from epnum 2 Steven Rostedt
2013-07-03 18:40 ` [102/141] drm/gma500: Increase max resolution for mode setting Steven Rostedt
2013-07-03 18:40 ` [103/141] powerpc: Set default VGA device Steven Rostedt
2013-07-03 18:40 ` [104/141] powerpc/pseries: Force 32 bit MSIs for devices that require it Steven Rostedt
2013-07-03 18:40 ` [105/141] powerpc/pseries: Perform proper max_bus_speed detection Steven Rostedt
2013-07-03 18:40 ` [106/141] radeon: use max_bus_speed to activate gen2 speeds Steven Rostedt
2013-07-03 18:40 ` [107/141] iio: frequency: ad4350: Fix bug / typo in mask Steven Rostedt
2013-07-03 18:40 ` [108/141] USB: serial: add wait_until_sent operation Steven Rostedt
2013-07-03 18:40 ` [109/141] USB: serial: add generic wait_until_sent implementation Steven Rostedt
2013-07-03 18:40 ` [110/141] USB: io_ti: fix chars_in_buffer overhead Steven Rostedt
2013-07-03 18:40 ` [111/141] xen/smp: Fixup NOHZ per cpu data when onlining an offline CPU Steven Rostedt
2013-07-03 18:40 ` [112/141] b43: stop format string leaking into error msgs Steven Rostedt
2013-07-03 18:40 ` [113/141] ceph: add cpu_to_le32() calls when encoding a reconnect capability Steven Rostedt
2013-07-03 18:40 ` [114/141] ceph: ceph_pagelist_append might sleep while atomic Steven Rostedt
2013-07-03 18:40 ` [115/141] drivers/rtc/rtc-twl.c: fix missing device_init_wakeup() when booted with device tree Steven Rostedt
2013-07-03 18:40 ` [116/141] drm/gma500/psb: Unpin framebuffer on crtc disable Steven Rostedt
2013-07-03 18:40 ` [117/141] drm/gma500/cdv: " Steven Rostedt
2013-07-03 18:40 ` [118/141] Bluetooth: Fix mgmt handling of power on failures Steven Rostedt
2013-07-03 18:40 ` [119/141] ath9k: Disable PowerSave by default Steven Rostedt
2013-07-03 18:40 ` [120/141] Revert "ath9k_hw: Update rx gain initval to improve rx sensitivity" Steven Rostedt
2013-07-03 18:40 ` [121/141] ath9k: Use minstrel rate control by default Steven Rostedt
2013-07-03 18:40 ` [122/141] CPU hotplug: provide a generic helper to disable/enable CPU hotplug Steven Rostedt
2013-07-03 18:41 ` [123/141] reboot: rigrate shutdown/reboot to boot cpu Steven Rostedt
2013-07-03 18:41 ` [124/141] kmsg: honor dmesg_restrict sysctl on /dev/kmsg Steven Rostedt
2013-07-03 18:41 ` [125/141] cciss: fix broken mutex usage in ioctl Steven Rostedt
2013-07-03 18:41 ` [126/141] drm/i915: prefer VBT modes for SVDO-LVDS over EDID Steven Rostedt
2013-07-03 18:41 ` [127/141] swap: avoid read_swap_cache_async() race to deadlock while waiting on discard I/O completion Steven Rostedt
2013-07-03 18:41 ` [128/141] md/raid1: consider WRITE as successful only if at least one non-Faulty and non-rebuilding drive completed it Steven Rostedt
2013-07-03 18:41 ` [129/141] md/raid1,raid10: use freeze_array in place of raise_barrier in various places Steven Rostedt
2013-07-03 18:41 ` [130/141] mm: migration: add migrate_entry_wait_huge() Steven Rostedt
2013-07-03 18:41 ` [131/141] x86: Fix typo in kexec register clearing Steven Rostedt
2013-07-03 18:41 ` [132/141] libceph: clear messenger auth_retry flag when we authenticate Steven Rostedt
2013-07-03 18:41 ` [133/141] libceph: fix authorizer invalidation Steven Rostedt
2013-07-03 18:41 ` [134/141] libceph: add update_authorizer auth method Steven Rostedt
2013-07-03 18:41 ` [135/141] libceph: wrap auth ops in wrapper functions Steven Rostedt
2013-07-03 18:41 ` [136/141] libceph: wrap auth methods in a mutex Steven Rostedt
2013-07-03 18:41 ` [137/141] powerpc: Fix stack overflow crash in resume_kernel when ftracing Steven Rostedt
2013-07-03 18:41 ` [138/141] powerpc: Fix emulation of illegal instructions on PowerNV platform Steven Rostedt
2013-07-03 18:41 ` [139/141] powerpc: Fix missing/delayed calls to irq_work Steven Rostedt
2013-07-03 18:41 ` [140/141] USB: pl2303: fix device initialisation at open Steven Rostedt
2013-07-03 18:41 ` [141/141] USB: spcp8x5: " Steven Rostedt
2013-07-03 19:16 ` [000/141] 3.6.11.6-stable review Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130703184055.903429244@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=dzickus@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tcamuso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).