Commit 93fca26c authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Linus Torvalds

[PATCH] usbfs: Remove extraneous disconnection checks

This patch fixes a bug in the usbfs code.  The driver is too zealous about
checking for disconnected devices before doing things.  In particular, it
is necessary to reap all outstanding asynchronous URBs and unbind from
interfaces when the device file is closed, even if the device is no longer
connected.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ccb5a461
......@@ -523,13 +523,12 @@ static int usbdev_release(struct inode *inode, struct file *file)
usb_lock_device(dev);
list_del_init(&ps->list);
if (connected(dev)) {
for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed); ifnum++)
if (test_bit(ifnum, &ps->ifclaimed))
releaseintf(ps, ifnum);
destroy_all_async(ps);
for (ifnum = 0; ps->ifclaimed && ifnum < 8*sizeof(ps->ifclaimed);
ifnum++) {
if (test_bit(ifnum, &ps->ifclaimed))
releaseintf(ps, ifnum);
}
destroy_all_async(ps);
usb_unlock_device(dev);
usb_put_dev(dev);
ps->dev = NULL;
......@@ -1023,7 +1022,7 @@ static int proc_reapurb(struct dev_state *ps, void __user *arg)
int ret;
add_wait_queue(&ps->wait, &wait);
while (connected(dev)) {
for (;;) {
__set_current_state(TASK_INTERRUPTIBLE);
if ((as = async_getcompleted(ps)))
break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment