Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 303902
b: refs/heads/master
c: 6286d85
h: refs/heads/master
v: v3
  • Loading branch information
Bjørn Mork authored and Greg Kroah-Hartman committed May 11, 2012
1 parent 103bec3 commit e16852e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b0b79d38806481c1c8fffa7c5842f3c83679a42
refs/heads/master: 6286d85e8efdb59252d1ceb99a56fa6b0b11526c
12 changes: 9 additions & 3 deletions trunk/drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,6 @@ static void free_urbs(struct wdm_device *desc)

static void cleanup(struct wdm_device *desc)
{
spin_lock(&wdm_device_list_lock);
list_del(&desc->device_list);
spin_unlock(&wdm_device_list_lock);
kfree(desc->sbuf);
kfree(desc->inbuf);
kfree(desc->orq);
Expand Down Expand Up @@ -782,6 +779,9 @@ static int wdm_create(struct usb_interface *intf, struct usb_endpoint_descriptor
out:
return rv;
err:
spin_lock(&wdm_device_list_lock);
list_del(&desc->device_list);
spin_unlock(&wdm_device_list_lock);
cleanup(desc);
return rv;
}
Expand Down Expand Up @@ -907,6 +907,12 @@ static void wdm_disconnect(struct usb_interface *intf)
cancel_work_sync(&desc->rxwork);
mutex_unlock(&desc->wlock);
mutex_unlock(&desc->rlock);

/* the desc->intf pointer used as list key is now invalid */
spin_lock(&wdm_device_list_lock);
list_del(&desc->device_list);
spin_unlock(&wdm_device_list_lock);

if (!desc->count)
cleanup(desc);
else
Expand Down

0 comments on commit e16852e

Please sign in to comment.