Netdev List
 help / color / mirror / Atom feed
From: zhengzongmin <zhengzongmin8@gmail.com>
To: linux-usb@vger.kernel.org, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] USB: hso: fix skb leak on device close and teardown
Date: Sun, 29 Nov 2026 06:31:06 -0800 (PST)	[thread overview]
Message-ID: <6b0c372a.1800fd7e.25977e.57fb@mx.google.com> (raw)

From: zhengzongmin <zhengzongmin8@gmail.com>
Date: Sun, 29 Nov 2026 18:59:36 +0800
Subject: [PATCH] USB: hso: fix skb leak on device close and teardown

hso_net_start_xmit() stashes an outgoing skb in odev->skb_tx_buf when
hso_get_activity() returns -EAGAIN. Neither hso_net_close() nor
hso_free_net_device() frees that skb, so when the device is brought
down or disconnected before it resumes, the skb and its head buffer
are permanently leaked. syzbot hit this with an IPv6 Router
Solicitation packet allocated by ndisc_send_rs().

Free the stashed skb in both paths. dev_kfree_skb() is NULL-safe, so
no extra check is needed, and clear the pointer afterwards.

Reported-by: syzbot+bf62ca9997f43d2fa521@syzkaller.appspotmail.com
Signed-off-by: zhengzongmin <zhengzongmin8@gmail.com>
---
 drivers/net/usb/hso.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 71caa37..2f46d51 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -726,6 +726,11 @@ static int hso_net_close()
 	/* no longer running */
 	clear_bit(HSO_NET_RUNNING, &odev->flags);
 
+	/* Release a packet stashed by hso_net_start_xmit() when the device
+	 * was busy. Otherwise it leaks when the device is brought down. */
+	dev_kfree_skb(odev->skb_tx_buf);
+	odev->skb_tx_buf = NULL;
+
 	hso_stop_net_device(odev->parent);
 
 	/* done */
@@ -2357,6 +2362,11 @@ static void hso_free_net_device()
 	if (hso_net->net)
 		unregister_netdev(hso_net->net);
 
+	/* A stashed skb may survive hso_net_close() if the device was never
+	 * brought up; make sure it is freed on the teardown path too. */
+	dev_kfree_skb(hso_net->skb_tx_buf);
+	hso_net->skb_tx_buf = NULL;
+
 	/* start freeing */
 	for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
 		usb_free_urb(hso_net->mux_bulk_rx_urb_pool[i]);
-- 
2.55.0.windows.3

                 reply	other threads:[~2026-11-29 14:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=6b0c372a.1800fd7e.25977e.57fb@mx.google.com \
    --to=zhengzongmin8@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@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