From: Oliver Neukum Date: Fri, 5 Jan 2007 16:42:35 +0000 (+0100) Subject: USB: race on disconnect in mdc800 X-Git-Tag: v2.6.21-rc2~42^2~9^2~43 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=f38649fee955c19f4df9b9e7267f87702712d973;p=linux-2.6-omap-h63xx.git USB: race on disconnect in mdc800 I overlooked one. Setting the flag and killing the URBs must be under the lock so that no URB is submitted after usb_kill_urb() Signed-off-by: Oliver Neukum Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/image/mdc800.c b/drivers/usb/image/mdc800.c index 63a84bbc310..d308afd0693 100644 --- a/drivers/usb/image/mdc800.c +++ b/drivers/usb/image/mdc800.c @@ -565,11 +565,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() */ + mutex_lock(&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); + mutex_unlock(&mdc800->io_lock); mdc800->dev = NULL; usb_set_intfdata(intf, NULL);