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 fix is incomplete. - [Medium] The patch puts a stale nexthop pcpu rt6_info (rt->sernum != 0) on the uncached list. -- ipv6: keep a superseded pcpu dst working until its holders notice This changes rt6_get_pcpu_route() so that an invalidated pcpu dst of a nexthop-object route is put on the uncached list instead of being dst_dev_put() when it is taken out of its per-CPU slot. The slot's reference is now dropped after an RCU grace period, so that RT6_LOOKUP_F_DST_NOREF readers are not left with a freed dst. Link: https://lore.kernel.org/netdev/2026…@kernel.org/
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c > index 39bcfa1ce01b1..df4d670bcfa60 100644 > --- a/net/ipv6/route.c > +++ b/net/ipv6/route.c > @@ -1499,8 +1499,8 @@ static struct rt6_info *rt6_get_pcpu_route(const struct fib6_result *res) > /* Paired with READ_ONCE() in __fib6_drop_pcpu_from() */ > prev = xchg(p, NULL); > if (prev) { > - dst_dev_put(&prev->dst); > - dst_release(&prev->dst); > + rt6_uncached_list_add(prev); > + rt6_dst_release_deferred(prev);
[Severity: High] The commit message describes two problems with a superseded nexthop pcpu dst: 1. dst_dev_put() turns a dst that is still held into a discard. 2. The slot reference is dropped without a grace period while RT6_LOOKUP_F_DST_NOREF readers may still be using the dst. Is the same pattern still there in fib6_nh_release_dsts()? net/ipv6/route.c:fib6_nh_release_dsts() { ... for_each_possible_cpu(cpu) { ... pcpu_rt = xchg(ppcpu_rt, NULL); if (pcpu_rt) { dst_dev_put(&pcpu_rt->dst); dst_release(&pcpu_rt->dst); } } } On a group replace, this runs synchronously under RTNL for every IPv6 member of the replaced group: replace_nexthop() nh_rt_cache_flush(net, old, new) fib6_nh_release_dsts(&nhi->fib6_nh) The member nexthops stay live, so readers on other CPUs can still get to their pcpu slots. Suppose the dst's references are the slot plus the child reference of an xfrm bundle B, and B's call_rcu() is already pending. Can this sequence free the dst under a NOREF reader? CPU1 CPU0 rcu_read_lock() ip6_route_input() takes the pcpu dst NOREF from its slot fib6_nh_release_dsts() xchg(ppcpu_rt, NULL) dst_release() /* 2 -> 1 */ B's grace period ends; it does not cover CPU1's read section dst_destroy(B) dst_release_immediate(child) /* 1 -> 0, freed */ uses the dst On a single nexthop replace, replace_nexthop_single() swaps nh_info. Then nexthop_put(new) reaches this path from an RCU callback: nexthop_free_single() fib6_nh_release() fib6_nh_release_dsts() The grace period problem doesn't apply there. But wouldn't dsts still held by sockets, a tunnel dst_cache, xfrm bundles or queued skbs be blackholed, just as the commit message describes for rt6_get_pcpu_route()? A nexthop replace looks like the most direct way for a nexthop pcpu dst to be superseded. Should fib6_nh_release_dsts() also use the uncached list and the deferred release? [Severity: Medium] Before this change, dst_dev_put() set dst.obsolete to DST_OBSOLETE_DEAD. Now a pcpu dst with rt->sernum set goes on the uncached list, and its obsolete stays DST_OBSOLETE_FORCE_CHK. When the device later goes down or is unregistered, rt6_uncached_list_flush_dev() does this: rcu_assign_pointer(rt->dst.dev_rcu, blackhole_netdev); ... from = unrcu_pointer(xchg(&rt->from, NULL)); fib6_info_release(from); It does not change obsolete or sernum. ip6_dst_check() then returns early for dsts that have a sernum: if (rt->sernum) return rt6_is_valid(rt) ? dst : NULL; So the rt->from check, which rejects other flushed uncached dsts, is never reached. rt6_is_valid() compares rt->sernum against rt_genid_ipv6(dev_net(rt->dst.dev)). After the flush that is init_net, because blackhole_netdev lives there. For a route in a non-init netns, ip6_rt_pcpu_alloc() took rt->sernum from the original netns. Every netns counter starts at 1 and goes up by one per FIB change. Can the stale sernum equal init_net's current fib6_sernum? If so, would ip6_dst_check() accept the blackholed dst? The socket, tunnel dst_cache or xfrm bundle holding it would then keep sending into blackhole_netdev until init_net's fib6_sernum changes. The commit message says rt6_uncached_list_flush_dev() detaches the dst "like any other uncached dst", but other uncached dsts have a zero sernum. Does the flush path, or the move to the uncached list, need to clear rt->sernum or mark the dst DST_OBSOLETE_DEAD?
> } > > pcpu_rt = NULL;
-- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cove…%40mandelbit.com