* [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close()
@ 2026-09-16 16:56 Wentao Liang
2026-09-17 9:04 ` Johan Hovold
0 siblings, 1 reply; 3+ messages in thread
From: Wentao Liang @ 2026-09-16 16:56 UTC (permalink / raw)
To: gregkh; +Cc: johan, linux-kernel, linux-usb, Wentao Liang, stable
usb_wwan_close() drains the delayed write urbs with
usb_get_from_anchor(), which returns the urb with a new reference
taken. The loop only clears the busy flag of the urb and never drops
that reference, so each drained urb keeps one reference forever and
the urb object is not freed when usb_wwan_port_remove() later drops
the port's own reference.
Drop the reference with usb_put_urb() once the urb has been found in
the out_urb array by unbusy_queued_urb(), leaving the reference held
by the port's preallocated out_urbs array.
Fixes: 79eed03e77d4 ("USB: usb_wwan: fix urb leak at shutdown")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/usb/serial/usb_wwan.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c
index e752ffa4dc62..2c46330f10da 100644
--- a/drivers/usb/serial/usb_wwan.c
+++ b/drivers/usb/serial/usb_wwan.c
@@ -403,6 +403,7 @@ void usb_wwan_close(struct usb_serial_port *port)
if (!urb)
break;
unbusy_queued_urb(urb, portdata);
+ usb_put_urb(urb);
usb_autopm_put_interface_async(serial->interface);
}
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close()
2026-09-16 16:56 [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close() Wentao Liang
@ 2026-09-17 9:04 ` Johan Hovold
2026-11-08 12:25 ` Wentao Liang
0 siblings, 1 reply; 3+ messages in thread
From: Johan Hovold @ 2026-09-17 9:04 UTC (permalink / raw)
To: Wentao Liang; +Cc: gregkh, linux-kernel, linux-usb, stable
On Wed, Sep 16, 2026 at 04:56:08PM +0000, Wentao Liang wrote:
> usb_wwan_close() drains the delayed write urbs with
> usb_get_from_anchor(), which returns the urb with a new reference
> taken. The loop only clears the busy flag of the urb and never drops
> that reference, so each drained urb keeps one reference forever and
> the urb object is not freed when usb_wwan_port_remove() later drops
> the port's own reference.
>
> Drop the reference with usb_put_urb() once the urb has been found in
> the out_urb array by unbusy_queued_urb(), leaving the reference held
> by the port's preallocated out_urbs array.
>
> Fixes: 79eed03e77d4 ("USB: usb_wwan: fix urb leak at shutdown")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Also looks correct, but again, how was this issue found and fixed?
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close()
2026-09-17 9:04 ` Johan Hovold
@ 2026-11-08 12:25 ` Wentao Liang
0 siblings, 0 replies; 3+ messages in thread
From: Wentao Liang @ 2026-11-08 12:25 UTC (permalink / raw)
To: Johan Hovold; +Cc: gregkh, linux-kernel, linux-usb, vulab
Hi Johan,
Sorry for the very late reply. Thank you for the review.
You are right that the drain loop leaks the reference taken by
usb_get_from_anchor(), and the same leak is in usb_wwan_submit_delayed_urbs().
I see you fixed both in c78dd373b5c5 ("USB: serial: usb_wwan: fix urb leak on
disconnect"), which is in mainline and has already been queued for stable, so
I am not resending either patch and patchwork 14822918 and 14822924 can be
dropped.
How this was found and fixed is described in my reply to the sierra patch; I
have not repeated it here.
I am going through the remaining feedback by hand now and will not post
patches in bulk again.
Thanks,
Wentao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-08 12:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 16:56 [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close() Wentao Liang
2026-09-17 9:04 ` Johan Hovold
2026-11-08 12:25 ` Wentao Liang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®