aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOliver Neukum <oliver@neukum.org>2008-03-19 22:43:12 +0200
committerAdrian Bunk <bunk@kernel.org>2008-03-19 22:43:12 +0200
commit03b7f70b359bcf52ac57516d18fa0f956a5eacf7 (patch)
tree61d1008caf1e27b4977383d4916b00cd424f6d02
parent4743272d12d443e241e02e2361db2f4c2dcb480e (diff)
USB: race on disconnect in mdc800
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>
-rw-r--r--drivers/usb/image/mdc800.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c
index 049871145d6..067dad0aaa6 100644
--- a/drivers/usb/image/mdc800.c
+++ b/drivers/usb/image/mdc800.c
@@ -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);