* [PATCH] usb: misc: usbio: Fix URB memory leak on submit failure
@ 2026-03-30 15:47 Felix Gu
2026-03-30 17:26 ` Oliver Neukum
0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-03-30 15:47 UTC (permalink / raw)
To: Israel Cepeda, Hans de Goede, Sakari Ailus, Greg Kroah-Hartman
Cc: linux-usb, linux-kernel, Felix Gu
When usb_submit_urb() fails in usbio_probe(), the previously allocated
URB is never freed, causing a memory leak.
Add usb_free_urb() call to properly release the URB on the error path.
Fixes: 121a0f839dbb ("usb: misc: Add Intel USBIO bridge driver")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
drivers/usb/misc/usbio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usbio.c b/drivers/usb/misc/usbio.c
index 2e68d48a2cc0..d4eb3c7bafc4 100644
--- a/drivers/usb/misc/usbio.c
+++ b/drivers/usb/misc/usbio.c
@@ -614,8 +614,10 @@ static int usbio_probe(struct usb_interface *intf, const struct usb_device_id *i
usb_fill_bulk_urb(usbio->urb, udev, usbio->rx_pipe, usbio->rxbuf,
usbio->rxbuf_len, usbio_bulk_recv, usbio);
ret = usb_submit_urb(usbio->urb, GFP_KERNEL);
- if (ret)
+ if (ret) {
+ usb_free_urb(usbio->urb);
return dev_err_probe(dev, ret, "Submitting usb urb\n");
+ }
mutex_lock(&usbio->ctrl_mutex);
---
base-commit: 3b058d1aeeeff27a7289529c4944291613b364e9
change-id: 20260330-usbio-d70e15c97a7a
Best regards,
--
Felix Gu <ustc.gu@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: misc: usbio: Fix URB memory leak on submit failure
2026-03-30 15:47 [PATCH] usb: misc: usbio: Fix URB memory leak on submit failure Felix Gu
@ 2026-03-30 17:26 ` Oliver Neukum
0 siblings, 0 replies; 2+ messages in thread
From: Oliver Neukum @ 2026-03-30 17:26 UTC (permalink / raw)
To: Felix Gu, Israel Cepeda, Hans de Goede, Sakari Ailus,
Greg Kroah-Hartman
Cc: linux-usb, linux-kernel
On 30.03.26 17:47, Felix Gu wrote:
> When usb_submit_urb() fails in usbio_probe(), the previously allocated
> URB is never freed, causing a memory leak.
>
> Add usb_free_urb() call to properly release the URB on the error path.
Hi,
the driver uses goto to unwind. Could you use the existing code
with an additional label defined?
Regards
Oliver
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-30 17:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 15:47 [PATCH] usb: misc: usbio: Fix URB memory leak on submit failure Felix Gu
2026-03-30 17:26 ` Oliver Neukum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox