summaryrefslogtreecommitdiffstats
path: root/drivers/usb/wusbcore
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2009-12-07 13:50:40 +0000
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 11:55:26 -0800
commit2e9729d0f86094e52d14e8b9e17c0aad565ee477 (patch)
tree66c8fad3b1ecb67e0b2fd762ffd17565d3aaa135 /drivers/usb/wusbcore
parent0d370755dd4ad3d119818579cfa3eb2e9978b3eb (diff)
downloadop-kernel-dev-2e9729d0f86094e52d14e8b9e17c0aad565ee477.zip
op-kernel-dev-2e9729d0f86094e52d14e8b9e17c0aad565ee477.tar.gz
USB: wusb: don't leak urb in certain error cases
Don't leak an urb in wusb_dev_alloc() if the following kmalloc() failed. Reported-by: Julia Lawall <julia@diku.dk> Signed-off-by: David Vrabel <david.vrabel@csr.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/wusbcore')
-rw-r--r--drivers/usb/wusbcore/devconnect.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/usb/wusbcore/devconnect.c b/drivers/usb/wusbcore/devconnect.c
index 4ac4300..dced419 100644
--- a/drivers/usb/wusbcore/devconnect.c
+++ b/drivers/usb/wusbcore/devconnect.c
@@ -119,10 +119,12 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc)
urb = usb_alloc_urb(0, GFP_KERNEL);
if (urb == NULL)
goto err;
+ wusb_dev->set_gtk_urb = urb;
- req = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ req = kmalloc(sizeof(*req), GFP_KERNEL);
if (req == NULL)
goto err;
+ wusb_dev->set_gtk_req = req;
req->bRequestType = USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE;
req->bRequest = USB_REQ_SET_DESCRIPTOR;
@@ -130,9 +132,6 @@ static struct wusb_dev *wusb_dev_alloc(struct wusbhc *wusbhc)
req->wIndex = 0;
req->wLength = cpu_to_le16(wusbhc->gtk.descr.bLength);
- wusb_dev->set_gtk_urb = urb;
- wusb_dev->set_gtk_req = req;
-
return wusb_dev;
err:
wusb_dev_free(wusb_dev);
OpenPOWER on IntegriCloud