🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26908

[PATCH net-next 2/2] ipv6: keep a superseded pcpu dst working until its holders notice

#26908
From: Ralf Lici
Date: Fri, 04 Dec 2026 11:29
57 lines
11594 bytes
From: David Ahern <dahern@nvidia.com>

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 <ralf@mandelbit.com>
Closes: https://lore.kernel.org/netdev/20261124204623.45969-1-ralf@mandelbit.com/
Signed-off-by: David Ahern <dahern@nvidia.com>
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 <ralf@mandelbit.com>
---
 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
Technical Details
Message-ID: <f595ecd06c4bb9dedaedaa5205b05bd46702d837.1796382820.git.ralf@mandelbit.com>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377309-linux-kernel-netdev=dewy.ru
References: <cover.1796382820.git.ralf@mandelbit.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377309-linux-kernel-netdev=dewy.ru
From: ralf@mandelbit.com (Ralf Lici)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 2/2] ipv6: keep a superseded pcpu dst working until its holders notice
Date: Fri,  4 Dec 2026 12:29:28 +0100
Organization: Usenet Network
Message-ID: <f595ecd06c4bb9dedaedaa5205b05bd46702d837.1796382820.git.ralf@mandelbit.com>
References: <cover.1796382820.git.ralf@mandelbit.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2751202"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:9ZwSSyYmb2mFQvPmaZnObH90+3A= sha256:m6Ca1Lu1KPLliUfwjuPoHk58E2CuXPWGvBy4hc/bPEE=
	sha1:th+o9eEeQ0KF1OIANsCyWXUf/1M= sha256:F92UHRhfO/OimLy2U23Y6w7TsPwKY68qOopi3Dnk53M=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 64DA0117BCC; Fri,  4 Dec 2026 14:30:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.298
X-Spam-Status: No, score=-3.298 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=mandelbit.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id E3JE5Ai0rn7G;
	Fri,  4 Dec 2026 14:30:13 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-377309-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id 43B40117BCF; Fri,  4 Dec 2026 14:30:04 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id E7EC22C89F; Fri,  4 Dec 2026 11:29:59 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796383798;
	b=juNZDJUsqhIuDzZOv8cJp5UkToaoXAAXLBHSgqi+Qf0sXrowPJz/CCVC5S+hGgAFpUM9
	 lEfIZdZMoD3TmyiYOGFKPerqCxPJPt6XuvH/ZkCrcJmEQM5E6MdylgV5+HDty6WqTX+qN
	 djc5BvrjWifqrqFlI1xsj1F6cehKdIn7zF5f2CeCl0tt89zW82KSpBn3HZ/rBjrIUvZ/0
	 vt48BA8RSbTetfjLQ/8EnjuVHMGrg5wEbXq+kajAppXGDTrSPdrgvCKffhhhIeyEZX5MI
	 xu/qhFrYvggCE8OxCtux6+jyzzDuXGuBs1ImBMNR+fKIrSw4WGbrLemWT4/uXA2NbkQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383798;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:To:
	 Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=C9xq2XUPUQAnEfPhKzRjdxEmqc5wShkVIz+yyGgSDYM=;
	b=NvcBY6jBkUhDuUVdMKL5hFxKnKeFOb0g6VjyS+oI9eBBlkoggY55G/qoTY+lM9fuEGMn
	 JlAmDzYtuV1xYZ4BNbechEc6INMvGyOirUMY61T079v0JrWBe0p3+RIG/fCTFpmj+PI+x
	 OQI7QW/DOaUp/I7AJkCU6IdxCboajdvHWKRYlT1DwWOos5+L31aC2fFVd3p/On71aw45o
	 oqYZE0Mbnuhydi5kGMVBN2jaFZ9+FL5s+RjY66bIGhmXyAsjPvC9Uo/P8T7x3Q+TwYHMN
	 a7SN5u2Ia76GzQUF3D1ccG0GPgrj5qbtk3KS829QL56CFb06i/2ij/AtVWS+t+GWu9w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=J9c1Eg0m;
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id C3461606A339;
	Fri,  4 Dec 2026 11:29:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=J9c1Eg0m
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=195.10.208.40
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796383793;
	b=NUqLyacIj/me+xwNODjIdJt//GwpOMxZz8jNU7ZInUT6KHL9HMhhgSP3zM6eVXGA4EpH
	 C+OO11f/mvTE0kA+4o6g5yxV7PFwePT8DDyBpq/PkO7HkdxPcEGTIfS4knGCHfeFk5eKG
	 Cg6zwowj38NC28OK/YpoxXFAmWsL45Digax/BgpekJ1tgwuEoovJFysa9nuSZZMf/g2s+
	 PvunA4f29Li3swcrzO8Sz5CyqlKfBan3SCwvEL3o7daFX4FWLUzZg8jNXTy3TvHGwrAbq
	 svRd7CFqAiTAARIq3xtZ2QJ77Si+LjPmE16TgCmmaDVyla3VWqznberG2m1HiOgI0/g==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796383793;
	h=DMARC-Filter:Received:DKIM-Signature:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding:X-Rspamd-Queue-Id;
	bh=C9xq2XUPUQAnEfPhKzRjdxEmqc5wShkVIz+yyGgSDYM=;
	b=C61BSvP84GafN9KfDeCKc8r9WHLdSL/QoQ4hOV8L3/QBP8BuOhTLDE1pnMTuJZFTpg4q
	 nongjM4+ypt+A++/8V6ftAJjgM1y7eFyq4ky1sU4hQvqzmxH7sb+hTWaH375F68a9TGOG
	 asPodl3AT0EDkc1jXr4HUPJdEq6OCKLBXo6voqt9SszX83k+JOJanSz8ZRsl1JxqPSHS4
	 Nvc+OIbsXzt2IwmoRI7x13ncAlRpa3p0STy0N8Uj3XHS9jjfiFZLeWwHh2IuQXpcMbp9X
	 8TAzrBj7Iu22OjIpv4vOfoa2blwv7yTrUieLm0QqO5ZsDSxoM8tD7RItnFs/boZf6pw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=mandelbit.com;
	spf=pass smtp.mailfrom=mandelbit.com;
	dkim=pass header.d=mandelbit.com header.i=@mandelbit.com header.a=rsa-sha256 header.s=MBO0001 header.b=J9c1Eg0m;
	arc=none smtp.remote-ip=195.10.208.40
X-Received: from mout-b-210.mailbox.org (mout-b-210.mailbox.org [195.10.208.40])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BDEC606A32D;
	Fri,  4 Dec 2026 11:29:52 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6BDEC606A32D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=mandelbit.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mandelbit.com
X-Received: from smtp1.mailbox.org (smtp1.mailbox.org [IPv6:2001:67c:2050:b231:465::1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519MLKEM768 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mout-b-210.mailbox.org (Postfix) with ESMTPS id 4jgq5y70LvzFr26;
	Fri, 04 Dec 2026 12:29:42 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mandelbit.com;
	s=MBO0001; t=1796383783;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references;
	bh=C9xq2XUPUQAnEfPhKzRjdxEmqc5wShkVIz+yyGgSDYM=;
	b=J9c1Eg0m30u348T5SEHRcy3BBadC8jiQlOnbunC1EmyaTUCwMe1vPmw12+ovN4i7ZlOORD
	PgHMC5Uff6lQG8t2QxFYkZcAxDiLaAEbcujAIk+J7no+VXEKVeFCtw8IwvHR2AFzpy/DYB
	JYT62nRUdJ+mAeZ/ZWApOkvVlboWnY1tRxzMvNPuPrYqsgyTpqMDrhpPv9cEHZG5pSQkWq
	pkJW1nRFOBycbo95f3Mk3gMLa2VjEvnb7B5ourgBrayXVEFliGPr6rcIXbLl44/iL64r1P
	x+Q6XTdFjvAf4VbddW3/C0ZlwT+N2Hn9FYCLtE8Hl9HfdonwiG8LupX8M4dZng==
X-Authentication-Results: outgoing_mbo_mout;
	dkim=none;
	spf=pass (outgoing_mbo_mout: domain of ralf@mandelbit.com designates 2001:67c:2050:b231:465::1 as permitted sender) smtp.mailfrom=ralf@mandelbit.com
X-Cc: David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	Simon Horman <horms@kernel.org>,
	linux-kernel@vger.kernel.org,
	David Ahern <dahern@nvidia.com>,
	Andrea Mayer <andrea.mayer@uniroma2.it>,
	Antonio Quartulli <antonio@mandelbit.com>
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <cover.1796382820.git.ralf@mandelbit.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-Rspamd-Queue-Id: 4jgq5y70LvzFr26