[PATCH] drivers: usb: host: fix prevent memory leak in interrupt message submission

Tom Rini trini at konsulko.com
Fri May 16 20:31:53 CEST 2025


On Fri, May 16, 2025 at 08:54:34PM +0300, ant.v.moryakov at gmail.com wrote:

> From: Anton Moryakov <ant.v.moryakov at gmail.com>
> 
> Ensure int_queue is properly destroyed when receiving wrong buffer
> by adding error handling path. Fixes memory leak that occurred
> when backbuffer validation failed.
> 
> Signed-off-by: Anton Moryakov <ant.v.moryakov at gmail.com>
> ---
>  drivers/usb/host/ehci-hcd.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
> index 7d5519c65a9..765d8b327ee 100644
> --- a/drivers/usb/host/ehci-hcd.c
> +++ b/drivers/usb/host/ehci-hcd.c
> @@ -1557,6 +1557,7 @@ static int _ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
>  		debug("got wrong buffer back (%p instead of %p)\n",
>  		      backbuffer, buffer);
>  		return -EINVAL;
> +		goto err;

A goto after return cannot be right, and should have had some compiler
warnings too.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250516/51989ecc/attachment.sig>


More information about the U-Boot mailing list