Hello.

On 13-02-2013 20:22, Tony Camuso wrote:

First version was created from RHEL. This one is created from 3.8 rc7

Commit 71c731a

  Please also specify that commit's summary in parens (or however you like).

was a workaround for systems using the SN65LVPE502CP,
controller, but it introduced a bug where resume from hibernate would
add the comp_mode_recovery_timer to the timer queue while it was already
active when saved to disk on hibernate. This caused list_add corruption
leading to a crash when resuming from hibernate.

The original patch erroneously assumed that the timer would be deleted
by a call to xhci_suspend() or xhci_stop(), but neither of these calls
is made during the hibernate sequence. When returning from hibernate,
the timer was still active, and the attempt to list_add the same timer
corrupted the list.

We can avoid this problem when resuming from hibernate by first deleting
the timer and then initializing it and adding it to the timer list.

Signed-off-by: Tony Camuso <tcam...@redhat.com>
Acked-by: Don Zickus <dzic...@redhat.com>
---
  drivers/usb/host/xhci.c |    9 ++++++++-
  1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index f1f01a8..61d25be 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -988,6 +988,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)))) {

   You don't need () around !x.

+                       del_timer_sync(&xhci->comp_mode_recovery_timer);
+                       xhci_dbg(xhci, "Compliance Mode Recovery Timer 
Deleted!\n");

   Why all words capitalized?

+               }
+
                /* 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);
@@ -1071,7 +1078,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) && (!hibernated))

   Again, no need for () around !x.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to