Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 1 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). - [Medium] remove_nexthop_from_groups() in net/ipv4/nexthop.c decides whether to bump the IPv6 generation too early. - [Low] The commit fixes two user-visible bugs: stale IPv6 dsts after replacing a member used only through a group, and after removing a… -- nexthop: bump the IPv6 route generation on group changes This commit bumps the netns IPv6 route generation in two more cases: when a group member is replaced and IPv6 routes use it only through a group, and when a member is removed from a group. The aim is that dsts built from the old group no longer pass validation.
> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c > index 53431fe7d3281..7cf496589f4f4 100644 > --- a/net/ipv4/nexthop.c > +++ b/net/ipv4/nexthop.c
[ ... ]
> @@ -2134,13 +2150,19 @@ remove_nexthop_from_groups(struct net *net, struct nexthop *nh, > if (list_empty(&nh->grp_list)) > return false; > > - list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) > + list_for_each_entry_safe(nhge, tmp, &nh->grp_list, nh_list) { > + have_f6i |= nh_has_f6i(nhge->nh_parent); > need_flush |= remove_nh_grp_entry(net, nhge, nlinfo, > &deferred_free); > + } > > /* make sure all see the newly published array before releasing rtnl */ > synchronize_net(); > > + /* a group lost a member: dsts built from the old group are stale */ > + if (have_f6i) > + rt_genid_bump_ipv6(net); > +
[Severity: Medium] Can the bump be skipped if an IPv6 route is added to the group while the member is being removed? have_f6i is read from the parent's f6i_list before remove_nh_grp_entry() publishes the new array with rcu_assign_pointer(nhp->nh_grp, newg). It is then used after synchronize_net(). IPv6 route insertion does not hold RTNL. RTM_NEWROUTE is registered with RTNL_FLAG_DOIT_UNLOCKED, and ip6_route_info_create_nh() looks up the nexthop under rcu_read_lock(). fib6_add_rt2node_nh() then links the route into the group's f6i_list while holding only the group's nh->lock: net/ipv6/ip6_fib.c:fib6_add_rt2node_nh() { ... list_add(&rt->nh_list, &rt->nh->f6i_list); ... } So with member X being deleted from group G, this sequence looks possible: CPU0 (holds RTNL, deleting X) remove_nexthop_from_groups() nh_has_f6i(G) returns false, have_f6i stays false CPU1 (RTM_NEWROUTE with nhid=G) fib6_add_rt2node_nh() route R is linked into G->f6i_list CPU2 ip6_pol_route() finds R, selects a path from the old G->nh_grp, and builds a dst stamped with the current generation CPU0 remove_nh_grp_entry() rcu_assign_pointer(nhp->nh_grp, newg); synchronize_net() have_f6i is false, so rt_genid_bump_ipv6() is not called The later "ipv6: stamp dsts with the generation sampled before the FIB lookup" change does not help here. No bump follows the publish, so the sampled generation is still current. rt6_is_valid() keeps passing until some unrelated FIB change. This looks like the "dsts built from the old group stayed valid" case that the commit message says it closes. Two kinds of dst would stay valid: - pcpu dsts through surviving members, built under the old hash-threshold or resilient mapping - uncached FLOWI_FLAG_KNOWN_NH clones through the deleted member, which fib6_nh_release_dsts() does not reach Pcpu dsts held in the deleted member's own rt6i_pcpu are released with dst_dev_put() when X is freed, so they are not affected. Could the decision be made after synchronize_net(), using the surviving parents (the nh_parent of the entries on deferred_free)? Another option is to bump every time a group loses a member, since rt_genid_bump_ipv6() is now a plain counter update. [ ... ]
> @@ -2264,7 +2286,8 @@ static void nh_rt_cache_flush(struct net *net, struct nexthop *nh, > if (!list_empty(&nh->fi_list)) > rt_cache_flush(net); > > - if (nh_has_f6i(nh)) > + /* dsts are validated against the netns route generation */ > + if (nh_used_by_f6i(nh)) > rt_genid_bump_ipv6(net);
[Severity: Low] This isn't a bug, but should this commit carry a Fixes: tag? Both gaps predate this series. The check in nh_rt_cache_flush() that looks only at the member's own f6i_list goes back to the original nh_rt_cache_flush() in commit 7bf4796dd09984 ("nexthops: add support for replace"). Blame also points at 4787a6d2629b4e. The baseline remove_nexthop_from_groups() never bumps the IPv6 generation after republishing a group. Other fixes in this series have Fixes: tags. Examples are "ipv6: keep a superseded pcpu dst working until its holders notice" and "ipv6: allocate the exception entry before removing the one it replaces". Without a tag here, stable maintainers cannot tell which kernels need this change.
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40kernel.org