Commit 8788fa03 authored by Michael Grzeschik's avatar Michael Grzeschik Committed by Greg Kroah-Hartman

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: default avatarMichael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8cb22680
...@@ -1562,11 +1562,14 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -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)) { if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
retval = -ESHUTDOWN; retval = -ESHUTDOWN;
qtd_list_free(&new_qtds);
goto out; goto out;
} }
retval = usb_hcd_link_urb_to_ep(hcd, urb); retval = usb_hcd_link_urb_to_ep(hcd, urb);
if (retval) if (retval) {
qtd_list_free(&new_qtds);
goto out; goto out;
}
qh = urb->ep->hcpriv; qh = urb->ep->hcpriv;
if (qh) { if (qh) {
...@@ -1584,6 +1587,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, ...@@ -1584,6 +1587,7 @@ static int isp1760_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
if (!qh) { if (!qh) {
retval = -ENOMEM; retval = -ENOMEM;
usb_hcd_unlink_urb_from_ep(hcd, urb); usb_hcd_unlink_urb_from_ep(hcd, urb);
qtd_list_free(&new_qtds);
goto out; goto out;
} }
list_add_tail(&qh->qh_list, ep_queue); list_add_tail(&qh->qh_list, ep_queue);
......
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