summaryrefslogtreecommitdiff
path: root/drivers/usb/wusbcore/wusbhc.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2009-04-08 21:36:32 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-17 21:50:28 +0400
commit5936ac7f93965931c508e1928d142076998ce65d (patch)
treeab6eafd9032dd6bf4b9b35d1c799745de2487000 /drivers/usb/wusbcore/wusbhc.c
parent8db324ec4322a15cf8819b8a7f0eff5aa98b2ff6 (diff)
downloadlinux-5936ac7f93965931c508e1928d142076998ce65d.tar.xz
WUSB: fix oops when completing URBs for disconnected devices
Fix an oops in wusbhc_giveback_urb() if the wusb device had disconnected while an urb was in progress. Also release the ref count obtained here. Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/wusbcore/wusbhc.c')
-rw-r--r--drivers/usb/wusbcore/wusbhc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/wusbcore/wusbhc.c b/drivers/usb/wusbcore/wusbhc.c
index 07c63a31c799..3638cc68529f 100644
--- a/drivers/usb/wusbcore/wusbhc.c
+++ b/drivers/usb/wusbcore/wusbhc.c
@@ -339,13 +339,15 @@ void wusbhc_giveback_urb(struct wusbhc *wusbhc, struct urb *urb, int status)
{
struct wusb_dev *wusb_dev = __wusb_dev_get_by_usb_dev(wusbhc, urb->dev);
- if (status == 0) {
+ if (status == 0 && wusb_dev) {
wusb_dev->entry_ts = jiffies;
- /* wusbhc_devconnect_acked() can't be called from from
+ /* wusbhc_devconnect_acked() can't be called from
atomic context so defer it to a work queue. */
if (!list_empty(&wusb_dev->cack_node))
queue_work(wusbd, &wusb_dev->devconnect_acked_work);
+ else
+ wusb_dev_put(wusb_dev);
}
usb_hcd_giveback_urb(&wusbhc->usb_hcd, urb, status);