summaryrefslogtreecommitdiff
path: root/drivers/usb/host/isp1760-hcd.c
diff options
context:
space:
mode:
authorMichael Grzeschik <m.grzeschik@pengutronix.de>2012-04-05 16:56:10 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-19 00:51:19 +0400
commit8788fa0344419d1d9bd1be3f61f1f0c4d9c1d568 (patch)
treee3e89efe9d4707d692f3d23b0a701ac86d96d125 /drivers/usb/host/isp1760-hcd.c
parent8cb2268001f9553f9ff83416ce3f009c4ab1e089 (diff)
downloadlinux-8788fa0344419d1d9bd1be3f61f1f0c4d9c1d568.tar.xz
isp1760-hcd: fix possible memory leak if urb could not be enqueued
After packetize_urb was called, we could still run into an error path and will not hand over the prepared qtd to the qtd_list. Make sure to free the prepared qtd in that case to avoid memory leaks. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/isp1760-hcd.c')
-rw-r--r--drivers/usb/host/isp1760-hcd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 4a378d38b954..a35bbddf8968 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -1562,11 +1562,14 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
retval = -ESHUTDOWN;
+ qtd_list_free(&new_qtds);
goto out;
}
retval = usb_hcd_link_urb_to_ep(hcd, urb);
- if (retval)
+ if (retval) {
+ qtd_list_free(&new_qtds);
goto out;
+ }
qh = urb->ep->hcpriv;
if (qh) {
@@ -1584,6 +1587,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
if (!qh) {
retval = -ENOMEM;
usb_hcd_unlink_urb_from_ep(hcd, urb);
+ qtd_list_free(&new_qtds);
goto out;
}
list_add_tail(&qh->qh_list, ep_queue);