lkml.org 
[lkml]   [2004]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/2] usbfs: Remove extraneous disconnection checks
[2 USB patches to be applied to the latest -bk tree, both fixing real
bugs. I figured it's easier than creating a whole bk tree for them]



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: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>

diff -Nru a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
--- a/drivers/usb/core/devio.c 2004-12-16 15:35:55 -08:00
+++ b/drivers/usb/core/devio.c 2004-12-16 15:35:55 -08:00
@@ -523,13 +523,12 @@

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;
@@ -1034,7 +1033,7 @@
int ret;

add_wait_queue(&ps->wait, &wait);
- while (connected(dev)) {
+ for (;;) {
__set_current_state(TASK_INTERRUPTIBLE);
if ((as = async_getcompleted(ps)))
break;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.117 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site