diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2011-02-02 13:59:33 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-03 19:46:48 -0500 |
commit | bf3d7d40e42a85ca73a34e1385ff34f092a384eb (patch) | |
tree | 3e23ffdcf11823bc13e5e525ce36639e170cab94 /drivers/usb/core | |
parent | d199c96d41d80a567493e12b8e96ea056a1350c1 (diff) |
USB: fix race between root-hub resume and wakeup requests
The USB core keeps track of pending resume requests for root hubs, in
order to resolve races between wakeup requests and suspends. However
the code that does this is subject to another race (between wakeup
requests and resumes) because the WAKEUP_PENDING flag is cleared
before the resume occurs, leaving a window in which another wakeup
request might arrive.
This patch (as1447) fixes the problem by clearing the WAKEUP_PENDING
flag after the resume instead of before it.
This fixes Bugzilla #24952.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Paul Bender <pebender@san.rr.com>
Tested-by: warpme <warpme@o2.pl>
Cc: stable <stable@kernel.org> [.36+]
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core')
-rw-r--r-- | drivers/usb/core/hcd.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 6a95017fa62..e935f71d7a3 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1955,7 +1955,6 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1955 | 1955 | ||
1956 | dev_dbg(&rhdev->dev, "usb %s%s\n", | 1956 | dev_dbg(&rhdev->dev, "usb %s%s\n", |
1957 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); | 1957 | (msg.event & PM_EVENT_AUTO ? "auto-" : ""), "resume"); |
1958 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1959 | if (!hcd->driver->bus_resume) | 1958 | if (!hcd->driver->bus_resume) |
1960 | return -ENOENT; | 1959 | return -ENOENT; |
1961 | if (hcd->state == HC_STATE_RUNNING) | 1960 | if (hcd->state == HC_STATE_RUNNING) |
@@ -1963,6 +1962,7 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) | |||
1963 | 1962 | ||
1964 | hcd->state = HC_STATE_RESUMING; | 1963 | hcd->state = HC_STATE_RESUMING; |
1965 | status = hcd->driver->bus_resume(hcd); | 1964 | status = hcd->driver->bus_resume(hcd); |
1965 | clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); | ||
1966 | if (status == 0) { | 1966 | if (status == 0) { |
1967 | /* TRSMRCY = 10 msec */ | 1967 | /* TRSMRCY = 10 msec */ |
1968 | msleep(10); | 1968 | msleep(10); |