From: netdev-bot+sashiko@kernel.org
To: subash.a.kasiviswanathan@oss.qualcomm.com
Cc: sean.tranchetti@oss.qualcomm.com, andrew+netdev@lunn.ch,
davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v5 3/5] net: qualcomm: rmnet: Fix MTU underflow and clamp to the maximum packet size
Date: Sat, 21 Nov 2026 07:04:03 +0000 [thread overview]
Message-ID: <179524464341.3135.12597930189751385790@kernel.org> (raw)
In-Reply-To: <20261117060737.2764327-4-subash.a.kasiviswanathan@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The commit message gets the pre-patch behaviour wrong in three
places.
Pre-existing issues:
- [Medium] At this patch, rmnet_vnd_newlink() sizes only the new device's
MTU, using that request's data_format.
--
net: qualcomm: rmnet: Fix MTU underflow and clamp to the maximum packet size
This commit adds rmnet_vnd_target_mtu(). The helper rejects real device
MTUs below the egress headroom and clamps the result to
RMNET_MAX_PACKET_SIZE. It is used for new and existing rmnet devices, and
the same underflow check is added to the other MTU helpers in
rmnet_vnd.c.
> The MTU helpers subtract the egress headroom from the real device MTU
> using unsigned arithmetic. A real device MTU smaller than the headroom
> underflows and results in a huge target MTU instead of an error.
[Severity: Low]
Does this hold for the rmnet_vnd_newlink() path?
Before this patch, rmnet_vnd_newlink() passed the wrapped u32 value as
the int new_mtu parameter of rmnet_vnd_change_mtu_with_format():
if (rmnet_vnd_change_mtu_with_format(rmnet_dev,
real_dev->mtu - headroom,
data_format)) {
As an int, the wrapped value is negative, so the existing "new_mtu < 0"
check already returned -EINVAL.
The underflow seems to have mattered in other places:
- the ndo_change_mtu bound in rmnet_vnd_change_mtu_with_format(). On a
tiny real device it accepted any MTU up to RMNET_MAX_PACKET_SIZE.
- rmnet_vnd_validate_real_dev_mtu(). It let the real device MTU drop
below the headroom.
- rmnet_vnd_update_dev_mtu(). It accepted a data format whose headroom
is larger than the real device MTU.
> Additionally, a real device with a jumbo MTU makes the creation of the
> first rmnet device fail since the unclamped value exceeds
> RMNET_MAX_PACKET_SIZE, while resizing an existing device clamps it.
Is "first" accurate here? Every rmnet_vnd_newlink() call seems to fail
while real_dev->mtu - headroom is above RMNET_MAX_PACKET_SIZE.
That includes a second device created after the real device MTU was
raised. The NETDEV_CHANGEMTU validation only rejects a shrink, so the
raise is allowed.
As for "clamps it", rmnet_vnd_update_dev_mtu() had no clamp before this
patch:
hash_for_each_safe(port->muxed_ep, bkt_ep, tmp_ep, ep, hlnode) {
if (ep->egress_dev->mtu <= (real_dev->mtu - headroom))
continue;
On a jumbo real device this condition is always true, so the function
does nothing. The patch doesn't change that. Existing MTUs are already at
most RMNET_MAX_PACKET_SIZE, so the loop still takes the continue.
This patch has a Fixes: tag. Could the commit message say more precisely
which paths were affected?
> diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> index 984c66bee863a..2f3fefe58bce3 100644
> --- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
> +++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c
[ ... ]
> @@ -336,11 +351,9 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev,
>
> priv->real_dev = real_dev;
>
> - headroom = rmnet_vnd_headroom(data_format);
> -
> - if (rmnet_vnd_change_mtu_with_format(rmnet_dev,
> - real_dev->mtu - headroom,
> - data_format)) {
> + new_mtu = rmnet_vnd_target_mtu(real_dev, data_format);
> + if (new_mtu < 0 ||
> + rmnet_vnd_change_mtu_with_format(rmnet_dev, new_mtu, data_format)) {
> NL_SET_ERR_MSG_MOD(extack, "Invalid MTU on real dev");
> return -EINVAL;
> }
[Severity: Medium]
This is a pre-existing issue, not one introduced by this patch.
Only the new device is sized here, using the data_format from this
request. rmnet_newlink() then overwrites the format for the whole port
and does not recheck the existing endpoints:
drivers/net/ethernet/qualcomm/rmnet/rmnet_config.c:rmnet_newlink() {
...
hlist_add_head_rcu(&ep->hlnode, &port->muxed_ep[mux_id]);
netdev_dbg(dev, "data format [0x%08X]\n", data_format);
WRITE_ONCE(port->data_format, data_format);
...
}
Can existing endpoints then send frames larger than the real device
MTU? For example, on a real device with MTU 1500:
- rmnet0 is created with the default format (headroom 4, MTU 1496).
- rmnet1 is then created with RMNET_FLAGS_EGRESS_MAP_CKSUMV4 set
(headroom 8).
After that, rmnet0 frames get the larger header, so a full-size rmnet0
frame comes out at 1504 bytes.
rmnet_changelink() covers this case. It calls rmnet_vnd_update_dev_mtu()
and restores old_data_format on failure. The newlink path does neither.
A later commit in the series, "net: qualcomm: rmnet: Publish data format
and mux_id only after the MTU update", appears to fix this. It calls
rmnet_vnd_update_dev_mtu(port, real_dev, data_format) from
rmnet_newlink() before publishing the format, and unwinds on failure.
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261117060737.2764327-1-subash.a.kasiviswanathan%40oss.qualcomm.com
next prev parent reply other threads:[~2026-11-21 7:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 6:07 [PATCH net v5 0/5] net: qualcomm: rmnet: Update MTU handling during format changes Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 1/5] net: qualcomm: rmnet: Account for V5 checksum header in headroom Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 2/5] net: qualcomm: rmnet: Size the first device from the requested data format Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` netdev-bot+sashiko
2026-11-17 6:07 ` [PATCH net v5 3/5] net: qualcomm: rmnet: Fix MTU underflow and clamp to the maximum packet size Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` netdev-bot+sashiko [this message]
2026-11-17 6:07 ` [PATCH net v5 4/5] net: qualcomm: rmnet: Publish data format and mux_id only after the MTU update Subash Abhinov Kasiviswanathan
2026-11-17 6:07 ` [PATCH net v5 5/5] net: qualcomm: rmnet: Resize endpoints with dev_set_mtu() and restore on failure Subash Abhinov Kasiviswanathan
2026-11-21 7:04 ` 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=179524464341.3135.12597930189751385790@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.tranchetti@oss.qualcomm.com \
--cc=subash.a.kasiviswanathan@oss.qualcomm.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®