From: netdev-bot+sashiko@kernel.org
To: chenaibing@cmss.chinamobile.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org,
kuba@kernel.org, pabeni@redhat.com, linux-usb@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] net: hso: cap the MTU to the mux tx buffer size
Date: Thu, 19 Nov 2026 19:50:04 +0000 [thread overview]
Message-ID: <179511780420.3136.11749400958773906297@kernel.org> (raw)
In-Reply-To: <20261116014904.556-1-chenaibing@cmss.chinamobile.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 0
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] This is an incomplete fix: the slab out-of-bounds write in
hso_net_start_xmit() can still be triggered.
--
net: hso: cap the MTU to the mux tx buffer size
This commit sets net->max_mtu in hso_net_init() to
MUX_BULK_TX_BUF_SIZE - 14. With that cap, userspace can no longer raise
the MTU of an hso net device past the fixed 2048 byte mux_bulk_tx_buf.
The intent is to stop the memcpy() in hso_net_start_xmit() from
overflowing that buffer.
> diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
> index 71caa3764b239..45713c9940894 100644
> --- a/drivers/net/usb/hso.c
> +++ b/drivers/net/usb/hso.c
> @@ -2393,6 +2393,7 @@ static void hso_net_init(struct net_device *net)
> net->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
> net->type = ARPHRD_NONE;
> net->mtu = DEFAULT_MTU - 14;
> + net->max_mtu = MUX_BULK_TX_BUF_SIZE - 14;
[Severity: High]
Is this enough to keep hso_net_start_xmit() from overflowing
mux_bulk_tx_buf?
max_mtu is only enforced by dev_validate_mtu() when dev->mtu changes.
It does not limit the length of skbs passed to ndo_start_xmit.
hso_net_start_xmit() still copies skb->len bytes without checking it:
drivers/net/usb/hso.c:hso_net_start_xmit() {
...
memcpy(odev->mux_bulk_tx_buf, skb->data, skb->len);
...
usb_fill_bulk_urb(odev->mux_bulk_tx_urb,
...
odev->mux_bulk_tx_buf, skb->len, write_bulk_callback,
odev);
...
}
mux_bulk_tx_buf is still a kzalloc(MUX_BULK_TX_BUF_SIZE) object
allocated in hso_create_net_device().
The stack does not guarantee skb->len <= dev->mtu at this point. These
paths look like they can send larger skbs whatever max_mtu is set to.
AF_PACKET packet_snd() with PACKET_VNET_HDR skips both MTU checks when
vnet_hdr.gso_type is set:
if (!vnet_hdr.gso_type &&
(len > dev->mtu + reserve + VLAN_HLEN + extra_len))
If gso_size is at least the payload size, __virtio_net_hdr_to_skb()
leaves the skb as non-GSO:
if (skb->len - nh_off > gso_size) {
So the skb is not segmented. validate_xmit_skb() only linearizes it, and
it reaches hso_net_start_xmit() at up to about 64KB.
AF_PACKET tpacket_snd() only clamps size_max to the MTU when no vnet
header is configured:
if ((size_max > dev->mtu + reserve + VLAN_HLEN) && !vnet_hdr_sz)
The per-frame MTU check is skipped in the same case.
For IPv4, ip_dst_mtu_maybe_forward() returns the route's RTAX_MTU
metric. That value is capped at IP_MAX_MTU but not at dev->mtu or
max_mtu. A route through the hso device with something like
"mtu lock 4000" would send 4000 byte packets to the driver without
fragmenting them.
In each case, an skb longer than 2048 bytes writes data chosen by the
sender past the end of mux_bulk_tx_buf. The same length is also used as
the URB transfer length.
Would a length check in hso_net_start_xmit() before the memcpy() be the
right fix? For example, if skb->len > MUX_BULK_TX_BUF_SIZE, drop the
skb, increment tx_dropped and restart the queue. The max_mtu cap could
stay as an extra guard.
Since this is tagged Cc: stable, wouldn't the backport as written leave
the mux_bulk_tx_buf overflow reachable?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261116014904.556-1-chenaibing%40cmss.chinamobile.com
prev parent reply other threads:[~2026-11-19 19:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 1:49 Aibing Chen
2026-11-16 1:53 ` netdev-bot+sinfo
2026-11-16 2:58 ` Aibing Chen
2026-11-19 19:50 ` netdev-bot+sashiko [this message]
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=179511780420.3136.11749400958773906297@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=chenaibing@cmss.chinamobile.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 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®