Skip to contentSkip to conversation

USB: hso: fix skb leak on device close and teardown

PATCH In review zhengzongmin 2 participants 2 messages Nov 29

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 USB: hso: fix skb leak on device close and teardown

From: zhengzongmin <[email protected]>
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.

---
 drivers/net/usb/hso.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/usb/hso.c +10 -0
index 71caa37..2f46d51 100644
@@ -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]);
Signature · 1 line
2.55.0.windows.3
maintainer
#1 lore raw
Quoted 3 lines · zhengzongmin

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

Why is this in the body of the email?

And full name please.

And how was this tested?

thanks,

greg k-h