Skip to content

Commit 4d2caeb

Browse files
P33Mpopcornmix
P33M
authored andcommitted
dwc_otg: prevent leaking URBs during enqueue
A dwc_otg_urb would get leaked if the HCD enqueue function failed for any reason. Free the URB at the appropriate points.
1 parent d3a2533 commit 4d2caeb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -797,11 +797,19 @@ static int dwc_otg_urb_enqueue(struct usb_hcd *hcd,
797797
#if USB_URB_EP_LINKING
798798
usb_hcd_unlink_urb_from_ep(hcd, urb);
799799
#endif
800+
DWC_FREE(dwc_otg_urb);
800801
urb->hcpriv = NULL;
801802
if (retval == -DWC_E_NO_DEVICE)
802803
retval = -ENODEV;
803804
}
804805
}
806+
#if USB_URB_EP_LINKING
807+
else
808+
{
809+
DWC_FREE(dwc_otg_urb);
810+
urb->hcpriv = NULL;
811+
}
812+
#endif
805813
DWC_SPINUNLOCK_IRQRESTORE(dwc_otg_hcd->lock, irqflags);
806814
return retval;
807815
}

0 commit comments

Comments
 (0)