From: Aibing Chen <chenaibing@cmss.chinamobile.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH] net: hso: cap the MTU to the mux tx buffer size
Date: Mon, 16 Nov 2026 09:49:04 +0800 [thread overview]
Message-ID: <20261116014904.556-1-chenaibing@cmss.chinamobile.com> (raw)
hso_net_start_xmit() copies skb->len bytes into odev->mux_bulk_tx_buf,
which is a fixed MUX_BULK_TX_BUF_SIZE (2048) allocation made by
hso_create_net_device(). The net device does not set max_mtu, so
userspace can raise the MTU up to IP_MAX_MTU and make that copy overflow
the buffer; the same length is passed to usb_fill_bulk_urb().
Cap the MTU at the buffer size, keeping the 14 byte allowance that the
default MTU already uses.
Fixes: 72dc1c096c70 ("HSO: add option hso driver")
Cc: stable@vger.kernel.org
Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>
---
drivers/net/usb/hso.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 71caa3764..45713c994 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;
net->tx_queue_len = 10;
net->ethtool_ops = &ops;
next reply other threads:[~2026-11-16 1:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 1:49 Aibing Chen [this message]
2026-11-16 1:53 ` netdev-bot+sinfo
2026-11-16 2:58 ` Aibing Chen
2026-11-19 19:50 ` netdev-bot+sashiko
2026-11-20 1:23 ` [PATCH v2] net: hso: cap the MTU and drop oversized frames Aibing Chen
2026-11-20 1:26 ` netdev-bot+sinfo
2026-11-20 9:53 ` Aibing Chen
2026-11-28 15:24 ` Simon Horman
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=20261116014904.556-1-chenaibing@cmss.chinamobile.com \
--to=chenaibing@cmss.chinamobile.com \
--cc=andrew+netdev@lunn.ch \
--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®