aboutsummaryrefslogtreecommitdiffstats
path: root/usb/usb-ehci-fix-bogus-alteration-of-a-local-variable.patch
blob: 98a62f947f79d95d8e11de0e91eb0ae963966432 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
From akpm@osdl.org  Fri Jun 30 16:39:44 2006
Message-Id: <200606300934.k5U9YgNT001781@shell0.pdx.osdl.net>
From: David Brownell <david-b@pacbell.net>
Subject: USB: ehci: fix bogus alteration of a local variable
To: greg@kroah.com
Cc: akpm@osdl.org, david-b@pacbell.net, dbrownell@users.sourceforge.net,
   saxofon@musiker.nu
Date: Fri, 30 Jun 2006 02:34:42 -0700

From: David Brownell <david-b@pacbell.net>

In a rare and all-but-unused path, the EHCI driver could reuse a variable
in a way that'd make trouble.  Specifically, if the first root hub port
gets an overcurrent event (rare) during a remote wakeup scenario (all but
unused in today's Linux, except for folk working with suspend-to-RAM and
similar sleep states), that would look like a fatal error which would shut
down the controller.  Fix by not reusing that variable.

Spotted by Per Hallsmark <saxofon@musiker.nu>
Fixes http://bugzilla.kernel.org/show_bug.cgi?id=6661

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/usb/host/ehci-hcd.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

--- gregkh-2.6.orig/drivers/usb/host/ehci-hcd.c
+++ gregkh-2.6/drivers/usb/host/ehci-hcd.c
@@ -625,10 +625,11 @@ static irqreturn_t ehci_irq (struct usb_
 			writel (status | CMD_RUN, &ehci->regs->command);
 
 		while (i--) {
-			status = readl (&ehci->regs->port_status [i]);
-			if (status & PORT_OWNER)
+			int pstatus = readl (&ehci->regs->port_status [i]);
+
+			if (pstatus & PORT_OWNER)
 				continue;
-			if (!(status & PORT_RESUME)
+			if (!(pstatus & PORT_RESUME)
 					|| ehci->reset_done [i] != 0)
 				continue;