]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
USB: race on disconnect in mdc800
authorOliver Neukum <oliver@neukum.org>
Wed, 19 Mar 2008 20:43:12 +0000 (22:43 +0200)
committerAdrian Bunk <bunk@kernel.org>
Wed, 19 Mar 2008 20:43:12 +0000 (22:43 +0200)
I overlooked one. Setting the flag and killing the URBs must be under the lo
so that no URB is submitted after usb_kill_urb()

Adrian Bunk:
Backported to 2.6.16.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
drivers/usb/image/mdc800.c

index 049871145d63735bd1fff17ee55dcc23a4ffd826..067dad0aaa651db8fa7637172c58cd251d417b67 100644 (file)
@@ -564,11 +564,15 @@ static void mdc800_usb_disconnect (struct usb_interface *intf)
 
                usb_deregister_dev(intf, &mdc800_class);
 
+               /* must be under lock to make sure no URB
+                  is submitted after usb_kill_urb() */
+               down (&mdc800->io_lock);
                mdc800->state=NOT_CONNECTED;
 
                usb_kill_urb(mdc800->irq_urb);
                usb_kill_urb(mdc800->write_urb);
                usb_kill_urb(mdc800->download_urb);
+               up (&mdc800->io_lock);
 
                mdc800->dev = NULL;
                usb_set_intfdata(intf, NULL);