Commit d4b73114 authored by Duncan Sands's avatar Duncan Sands Committed by Greg Kroah-Hartman

[PATCH] USB usbfs: destroy submitted urbs only on the disconnected interface

The remaining three patches contain miscellaneous fixes to usbfs.
This one fixes up the disconnect callback to only shoot down urbs
on the disconnected interface, and not on all interfaces.  It also adds
a sanity check (this check is pointless because the interface could
never have been claimed in the first place if it failed, but I feel better
having it there).

 devio.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
parent c441f19b
...@@ -341,6 +341,7 @@ static int driver_probe (struct usb_interface *intf, ...@@ -341,6 +341,7 @@ static int driver_probe (struct usb_interface *intf,
static void driver_disconnect(struct usb_interface *intf) static void driver_disconnect(struct usb_interface *intf)
{ {
struct dev_state *ps = usb_get_intfdata (intf); struct dev_state *ps = usb_get_intfdata (intf);
unsigned int ifnum = intf->altsetting->desc.bInterfaceNumber;
if (!ps) if (!ps)
return; return;
...@@ -349,11 +350,12 @@ static void driver_disconnect(struct usb_interface *intf) ...@@ -349,11 +350,12 @@ static void driver_disconnect(struct usb_interface *intf)
* all pending I/O requests; 2.6 does that. * all pending I/O requests; 2.6 does that.
*/ */
clear_bit(intf->cur_altsetting->desc.bInterfaceNumber, &ps->ifclaimed); if (ifnum < 8*sizeof(ps->ifclaimed))
clear_bit(ifnum, &ps->ifclaimed);
usb_set_intfdata (intf, NULL); usb_set_intfdata (intf, NULL);
/* force async requests to complete */ /* force async requests to complete */
destroy_all_async (ps); destroy_async_on_interface(ps, ifnum);
} }
struct usb_driver usbdevfs_driver = { struct usb_driver usbdevfs_driver = {
......
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