Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1b42ae6d4355328dc4406b6f0188adcf8c566435
Commit:     1b42ae6d4355328dc4406b6f0188adcf8c566435
Parent:     949be0f7be8de0c5a6a46626bd983f7a03a4b26e
Author:     Alan Stern <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 13 11:10:52 2007 -0400
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Apr 27 13:28:34 2007 -0700

    USB: fix race in HCD removal
    
    This patch (as865) fixes a race in the HCD removal code discovered by
    Milan Plzik.  Arrival of an interrupt after the root hub was
    unregistered could cause the root-hub status timer to start up, even
    after it was supposed to have been shut down.  The problem is fixed by
    moving the del_timer_sync() call to after the HCD's stop() method, at
    which time IRQ generation should be disabled.
    
    Cc: Milan Plzik <[EMAIL PROTECTED]>
    Signed-off-by: Alan Stern <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/hcd.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index b26c19e..af7aed1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -544,6 +544,8 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd)
        unsigned long   flags;
        char            buffer[4];      /* Any root hubs with > 31 ports? */
 
+       if (unlikely(!hcd->rh_registered))
+               return;
        if (!hcd->uses_new_polling && !hcd->status_urb)
                return;
 
@@ -1670,12 +1672,12 @@ void usb_remove_hcd(struct usb_hcd *hcd)
        usb_disconnect(&hcd->self.root_hub);
        mutex_unlock(&usb_bus_list_lock);
 
-       hcd->poll_rh = 0;
-       del_timer_sync(&hcd->rh_timer);
-
        hcd->driver->stop(hcd);
        hcd->state = HC_STATE_HALT;
 
+       hcd->poll_rh = 0;
+       del_timer_sync(&hcd->rh_timer);
+
        if (hcd->irq >= 0)
                free_irq(hcd->irq, hcd);
        usb_deregister_bus(&hcd->self);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to