From: sashiko-bot@kernel.org
To: zhengzongmin <zhengzongmin8@gmail.com>, linux-usb@vger.kernel.org
Subject: Re: [PATCH] USB: hso: fix skb leak on device close and teardown
Date: Mon, 30 Nov 2026 14:31:19 +0000 [thread overview]
Message-ID: <sashiko-outbox-241392@kernel.org> (raw)
In-Reply-To: <6b0c372a.1800fd7e.25977e.57fb@mx.google.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] USB: hso: race between hso_net_close() and hso_resume() on
skb_tx_buf
- [Low] USB: hso: missing Fixes trailer for skb_tx_buf leak fix
--
commit 3d6f9f23f19489f009b13c37018dd2945051ad93
Author: zhengzongmin <zhengzongmin8@gmail.com>
> 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>
[Severity: Low]
Should this bug fix include a Fixes: tag for the commit that introduced
skb_tx_buf stashing:
Fixes: 72dc1c096c70 ("HSO: add option hso driver")
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 71caa3764b239..2f46d51269d0a 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -726,6 +726,11 @@ static int hso_net_close(struct net_device *net)
> /* 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;
[Severity: High]
Can freeing odev->skb_tx_buf here race with hso_resume() and cause a
use-after-free and double free?
When hso_get_activity() returns -EAGAIN during transmit, it schedules
async_get_intf to resume the USB interface. hso_resume() runs under the
USB device PM lock without holding rtnl_lock or any lock shared with
hso_net_close(), and only clears skb_tx_buf after hso_net_start_xmit()
has transmitted and freed it:
drivers/net/usb/hso.c:hso_resume() {
...
if (hso_net->flags & IFF_UP) {
/* First transmit any lingering data,
then restart the device. */
if (hso_net->skb_tx_buf) {
dev_dbg(&iface->dev,
"Transmitting"
" lingering data\n");
hso_net_start_xmit(hso_net->skb_tx_buf,
hso_net->net);
hso_net->skb_tx_buf = NULL;
}
...
}
If the interface is brought down while async_get_intf (or system resume)
is running hso_resume(), both paths can consume the same skb:
CPU0 CPU1 (kworker / async_get_intf)
hso_resume()
if (hso_net->flags & IFF_UP)
skb = hso_net->skb_tx_buf
hso_net_close()
clear_bit(HSO_NET_RUNNING, ...)
dev_kfree_skb(odev->skb_tx_buf)
odev->skb_tx_buf = NULL
hso_net_start_xmit(skb, ...)
memcpy(..., skb->data, skb->len)
<-- use-after-free
dev_kfree_skb(skb)
<-- double free
--
Sashiko AI review · https://sashiko.dev/#/patchset/6b0c372a.1800fd7e.25977e.57fb@mx.google.com?part=1
next prev parent reply other threads:[~2026-11-30 14:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 14:31 [PATCH] USB: hso: fix skb leak on device close and teardown zhengzongmin
2026-11-29 16:52 ` Greg KH
2026-11-30 14:31 ` sashiko-bot [this message]
2026-11-30 15:28 ` netdev-bot+sashiko
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=sashiko-outbox-241392@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=zhengzongmin8@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.