From: netdev-bot+sashiko@kernel.org
To: deliran@verdict.gg
Cc: dsahern@kernel.org, idosch@nvidia.com, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
willemb@google.com, horms@kernel.org, shuah@kernel.org,
netdev@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v5 1/2] ipv6: Cache pmtu for all paths of a multipath route
Date: Thu, 03 Dec 2026 19:01:41 +0000 [thread overview]
Message-ID: <179632450109.3146.11168142309643609135@kernel.org> (raw)
In-Reply-To: <20261202182545.19656-2-deliran@verdict.gg>
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 1 · 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] The new walk over every path of a multipath route in
__ip6_rt_update_pmtu() (net/ipv6/route.c) still sits behind the…
- [Medium] rt6_nh_update_pmtu() adds a check-then-write on exception
routes that holds no lock.
--
ipv6: Cache pmtu for all paths of a multipath route
When a Packet Too Big is received, __ip6_rt_update_pmtu() now walks
every path of a multipath route. This covers both legacy siblings and
nexthop objects. On each path it updates an existing exception in place,
or creates one if the reported MTU is lower than that path's MTU,
following what IPv4 does since commit 7d3f3b4367f3.
Link: https://lore.kernel.org/netdev/ad29493c-9e48-4a94-b327-e47af3a9d137@kernel.org/
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index df843178e5ecc..cd3672287afed 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -2917,12 +2917,63 @@ static bool rt6_cache_allowed_for_pmtu(const struct rt6_info *rt)
[ ... ]
> +static int rt6_nh_update_pmtu(struct fib6_nh *nh, void *_arg)
> +{
> + struct rt6_pmtu_arg *arg = _arg;
> + struct fib6_result *res = &arg->res;
> + struct rt6_info *rt;
> +
> + res->nh = nh;
> + rt = rt6_find_cached_rt(res, arg->daddr, arg->saddr);
> + if (rt) {
> + /* Keep any gateway learned from a redirect. */
> + if (arg->mtu < dst6_mtu(&rt->dst)) {
> + rt6_do_update_pmtu(rt, arg->mtu);
[Severity: Medium]
Can this in-place update race with a device MTU decrease?
The check and the write here run under RCU only. There is no
rt6_exception_lock and no re-check against fib6_mtu(res). The device MTU
change path writes the same metric under the lock:
rt6_mtu_change()->fib6_nh_mtu_change()->rt6_exceptions_update_pmtu() {
...
if (dst_metric_raw(&entry->dst, RTAX_MTU) &&
rt6_mtu_change_route_allowed(idev, entry, mtu))
dst_metric_set(&entry->dst, RTAX_MTU, mtu);
...
}
rt6_insert_exception() re-checks under the lock for this exact reason:
/* rt6_mtu_change() might lower mtu on f6i.
* Only insert this exception route if its mtu
* is less than f6i's mtu value.
*/
if (dst_metric_raw(&nrt->dst, RTAX_MTU) >= fib6_mtu(res)) {
A possible interleaving:
CPU0 (softirq, PTB mtu=1400)
rt6_nh_update_pmtu()
arg->mtu (1400) < dst6_mtu(&rt->dst) (1500)
CPU1 (NETDEV_CHANGEMTU to 1300)
rt6_exceptions_update_pmtu()
dst_metric_set(&entry->dst, RTAX_MTU, 1300)
CPU0
rt6_do_update_pmtu(rt, 1400)
dst_metric_set(&rt->dst, RTAX_MTU, 1400)
ip6_dst_mtu_maybe_forward() returns the raw metric without clamping it to
the device MTU. The exception would then report 1400 on a 1300 MTU
device until it expires (ip6_rt_mtu_expires, 600s by default).
The RTF_CACHE branch for the selected dst in __ip6_rt_update_pmtu()
already had this unlocked pattern. This patch adds a new instance that
applies to the exceptions on every path.
Should the in-place update take rt6_exception_lock and re-check
fib6_mtu(), as rt6_insert_exception() does?
> + fib6_nh_update_exception(nh, res->f6i->fib6_src.plen,
> + rt);
> + }
> + return 0;
> + }
> +
> + if (arg->mtu >= fib6_mtu(res))
> + return 0;
[ ... ]
> @@ -2945,6 +2996,7 @@ static void __ip6_rt_update_pmtu(struct dst_entry *dst, const struct sock *sk,
>
> if (mtu < IPV6_MIN_MTU)
> return;
> +
> if (mtu >= dst6_mtu(dst))
> return;
[Severity: High]
Does this early return still block the per-path walk in the case the
commit message describes?
This check only compares against the MTU of the dst that the PTB lookup
selected. ip6_update_pmtu() builds that lookup without protocol or
ports:
struct flowi6 fl6 = {
.flowi6_oif = oif,
.flowi6_mark = mark ? mark : IP6_REPLY_MARK(net, skb->mark),
.daddr = iph->daddr,
.saddr = iph->saddr,
.flowlabel = ip6_flowinfo(iph),
.flowi6_uid = uid,
};
dst = ip6_route_output(net, NULL, &fl6);
So the lookup can select path A while the flow actually uses path B.
Path A may already have an MTU at or below the reported value. It may
have a smaller link MTU, or it may still hold a lower exception after
B's was flushed or evicted. In either case __ip6_rt_update_pmtu() returns
here, before rcu_read_lock(), and never reaches the nexthop or sibling
walk.
For example, path A has link MTU 1400 and path B has 1500. The flow is
hashed to B, and a router on B reports 1450. The lookup selects A, the
check 1450 >= 1400 returns, and B keeps a PMTU of 1500. Oversized
packets on B continue to be dropped.
rt6_nh_update_pmtu() already makes its own per-path comparison:
if (arg->mtu >= fib6_mtu(res))
return 0;
Could this check gate only the in-place update of rt6, and let the walk
run either way?
IPv4's __ip_rt_update_pmtu() has a similar old_mtu < mtu gate. However,
the commit message here says "Compare the reported MTU with the MTU in
use on each path".
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202182545.19656-1-deliran%40verdict.gg
next prev parent reply other threads:[~2026-12-03 19:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 18:25 [PATCH net-next v5 0/2] ipv6: Cache pmtu for all paths of a multipath route Vladimir Vdovin
2026-12-02 18:25 ` [PATCH net-next v5 1/2] " Vladimir Vdovin
2026-12-03 19:01 ` netdev-bot+sashiko [this message]
2026-12-02 18:25 ` [PATCH net-next v5 2/2] selftests: net: pmtu: Add IPv6 multipath tests Vladimir Vdovin
2026-12-03 19:01 ` 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=179632450109.3146.11168142309643609135@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=davem@davemloft.net \
--cc=deliran@verdict.gg \
--cc=dsahern@kernel.org \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shuah@kernel.org \
--cc=willemb@google.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