mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wentao Liang <vulab@iscas.ac.cn>
To: gregkh@linuxfoundation.org
Cc: johan@kernel.org, linux-kernel@vger.kernel.org,
	linux-usb@vger.kernel.org, Wentao Liang <vulab@iscas.ac.cn>,
	stable@vger.kernel.org
Subject: [PATCH] USB: usb_wwan: Fix urb leak in usb_wwan_close()
Date: Wed, 16 Sep 2026 16:56:08 +0000	[thread overview]
Message-ID: <20260916165608.2085613-1-vulab@iscas.ac.cn> (raw)

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


             reply	other threads:[~2026-09-16 16:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 16:56 Wentao Liang [this message]
2026-09-17  9:04 ` Johan Hovold
2026-11-08 12:25   ` Wentao Liang

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=20260916165608.2085613-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=gregkh@linuxfoundation.org \
    --cc=johan@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 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®