Skip to content

Commit

Permalink
USB: race on disconnect in mdc800
Browse files Browse the repository at this point in the history
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 <oliver@neukum.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Feb 7, 2007
1 parent 6f23ee1 commit f38649f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/image/mdc800.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f38649f

Please sign in to comment.