aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAndiry Xu <andiry.xu@amd.com>2011-11-30 03:37:41 -0500
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2011-12-01 13:38:27 -0500
commit158886cd2cf4599e04f9b7e10cb767f5f39b14f1 (patch)
treef59d102f1460155cfb49d5fdff8da762a5dde533 /drivers/usb
parent6414e94c203d92b163ca61b5f51a25b80a621dbe (diff)
xHCI: fix bug in xhci_clear_command_ring()
When system enters suspend, xHCI driver clears command ring by writing zero to all the TRBs. However, this also writes zero to the Link TRB, and the ring is mangled. This may cause driver accesses wrong memory address and the result is unpredicted. When clear the command ring, keep the last Link TRB intact, only clear its cycle bit. This should fix the "command ring full" issue reported by Oliver Neukum. This should be backported to stable kernels as old as 2.6.37, since the commit 89821320 "xhci: Fix command ring replay after resume" is merged. Signed-off-by: Andiry Xu <andiry.xu@amd.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Reported-by: Oliver Neukum <oneukum@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/xhci.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index aa94c0195791..a1afb7c39f7e 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -711,7 +711,10 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci)
711 ring = xhci->cmd_ring; 711 ring = xhci->cmd_ring;
712 seg = ring->deq_seg; 712 seg = ring->deq_seg;
713 do { 713 do {
714 memset(seg->trbs, 0, SEGMENT_SIZE); 714 memset(seg->trbs, 0,
715 sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1));
716 seg->trbs[TRBS_PER_SEGMENT - 1].link.control &=
717 cpu_to_le32(~TRB_CYCLE);
715 seg = seg->next; 718 seg = seg->next;
716 } while (seg != ring->deq_seg); 719 } while (seg != ring->deq_seg);
717 720