From: David Ahern When rt6_get_pcpu_route() finds that a pcpu dst of a route using a nexthop object has been invalidated, it takes the dst out of its slot and calls dst_dev_put() on it. That points the dst at the blackhole device and makes its output a discard, although the dst may still be held: by a socket, a tunnel dst_cache, an xfrm bundle, or an skb that has not reached dst_output() yet (a queued or NFQUEUE reinjected packet, async crypto). Those packets are dropped, where the holder would have noticed that the dst is stale at its next check and looked the route up again. The dst does have to be detached from its device when the device is unregistered: it is no longer reachable from the FIB, and a holder such as an idle socket can keep it indefinitely, which would hold the device. Put it on the uncached list instead. It keeps working until its holders let go, and rt6_uncached_list_flush_dev() detaches it on unregister like any other uncached dst. Drop the slot's reference after a grace period too. A lookup with RT6_LOOKUP_F_DST_NOREF may have taken the dst from the slot without a reference, and when the only other reference is the child reference of an xfrm bundle, dst_destroy releases it with dst_release_immediate and frees the dst under that lookup. A later change to dst validation replaces the per-CPU dsts of all routes the same way. Reported-by: Ralf Lici Closes: https://lore.kernel.org/netdev/20261124204623.45969-1-ralf@mandelbit.com/ Signed-off-by: David Ahern Link: https://lore.kernel.org/netdev/20261201174021.7211-3-dsahern@kernel.org/ [ralf: drop the slot's reference after a grace period, drop the comment and the Fixes tag] Signed-off-by: Ralf Lici --- net/ipv6/route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 39bcfa1ce01b..df4d670bcfa6 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); } pcpu_rt = NULL; -- 2.56.1