From: ant.v.moryakov@gmail.com
To: u-boot@lists.denx.de
Cc: trini@konsulko.com, Anton Moryakov <ant.v.moryakov@gmail.com>
Subject: [PATCH] drivers: usb: host: fix prevent memory leak in interrupt message submission
Date: Fri, 16 May 2025 20:54:34 +0300 [thread overview]
Message-ID: <20250516175434.124221-1-ant.v.moryakov@gmail.com> (raw)
From: Anton Moryakov <ant.v.moryakov@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@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;
}
ret = _ehci_destroy_int_queue(dev, queue);
@@ -1565,6 +1566,10 @@ static int _ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
/* everything worked out fine */
return result;
+
+err:
+ _ehci_destroy_int_queue(dev, queue);
+ return result;
}
static int _ehci_lock_async(struct ehci_ctrl *ctrl, int lock)
--
2.30.2
next reply other threads:[~2025-05-16 17:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-16 17:54 ant.v.moryakov [this message]
2025-05-16 18:31 ` [PATCH] drivers: usb: host: fix prevent memory leak in interrupt message submission Tom Rini
2025-05-16 18:57 ` Anton Moryakov
2025-05-16 19:11 ` Tom Rini
-- strict thread matches above, loose matches on Subject: below --
2025-05-16 19:36 ant.v.moryakov
2025-05-16 19:59 ` Fabio Estevam
2025-05-16 20:04 ` Anton Moryakov
2025-05-16 17:50 ant.v.moryakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250516175434.124221-1-ant.v.moryakov@gmail.com \
--to=ant.v.moryakov@gmail.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.