Article View: linux.kernel.netdev
Article #20765[PATCH net] ipv6: reject released nexthop object routes in ip6_dst_check()
From: Qiliang Yuan
Date: Mon, 23 Nov 2026 06:59
Date: Mon, 23 Nov 2026 06:59
56 lines
10571 bytes
10571 bytes
A per-cpu IPv6 route through a nexthop object records the fib6_sernum of
its netns, and ip6_dst_check() accepts it as long as that value matches
the fib6_sernum of the netns of its device, without looking at
dst->obsolete as it does for per-cpu routes without a nexthop object.
When such a route is released with dst_dev_put(), for example when its
nexthop is deleted from a group or replaced in place and the old
nexthop is freed, it is pointed to blackhole_netdev, which belongs to
init_net. For a socket in init_net the recorded fib6_sernum stays
current until something else changes the IPv6 routes there, so the
socket keeps sending into blackhole_netdev: send() succeeds and every
datagram is dropped.
Reject routes that dst_dev_put() marked DST_OBSOLETE_DEAD in
rt6_is_valid(), as ipv4_dst_check() does, so that the socket looks up
its route again.
A connected UDP socket in init_net sends 3000 datagrams, one per ms, to
a route through group {nh 1, nh 2} taking nh 1, and nh 1 is deleted, or
replaced in place by one through the gateway of nh 2, after 1 s, with no
other IPv6 route change in init_net. Datagrams that arrived through
neither nexthop, 5 trials, median and range:
before (datagrams) after (datagrams) change
delete 2060 (2049-2064) 0 -100%
replace 2061 (2059-2065) 0 -100%
Fixes: 8f34e53b60b33 ("ipv6: Use global sernum for dst validation with nexthop objects")
Signed-off-by: Qiliang Yuan <qiliang.yuan@linux.dev>
---
net/ipv6/route.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 1b2dcc066e198..dbc878c09b870 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -1466,7 +1466,8 @@ static struct rt6_info *ip6_rt_pcpu_alloc(const struct fib6_result *res)
static bool rt6_is_valid(const struct rt6_info *rt6)
{
- return rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
+ return READ_ONCE(rt6->dst.obsolete) == DST_OBSOLETE_FORCE_CHK &&
+ rt6->sernum == rt_genid_ipv6(dev_net(rt6->dst.dev));
}
/* It should be called with rcu_read_lock() acquired */
---
base-commit: af6737b9066832a2017c281159950ba92385ce00
change-id: 20261123-bug-net-ipv6-dst-check-released-91ceae12f8e6
Best regards,
--
Qiliang Yuan <qiliang.yuan@linux.dev>
Technical Details
Message-ID:
<20261123-bug-net-ipv6-dst-check-released-v1-1-769d320a2470@linux.dev>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-369086-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.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-369086-linux-kernel-netdev=dewy.ru From: qiliang.yuan@linux.dev (Qiliang Yuan) Newsgroups: linux.kernel.netdev Subject: [PATCH net] ipv6: reject released nexthop object routes in ip6_dst_check() Date: Mon, 23 Nov 2026 01:59:13 -0500 Organization: Usenet Network Message-ID: <20261123-bug-net-ipv6-dst-check-released-v1-1-769d320a2470@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3812383"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:d1K1JQrCN6o2H8+M9GMkzgTTehk= sha256:64j3h9D93lYdJ0y2Bs/JLsyjxGD6j0oeb6t4uu1ZnDQ= sha1:QzpiXMDUNmcDD1auS/lJP1cY7ak= sha256:/RVpAJEGA1h9ZCquOW9F4b2u0cglQal+p+t5o9xQKYo= 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 DC783125D90; Mon, 23 Nov 2026 09:59:39 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.05 X-Spam-Status: No, score=-3.05 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.249, 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 (1024-bit key) header.d=linux.dev 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 GWFCzoY8QKOe; Mon, 23 Nov 2026 09:59:36 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-369086-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B5EE1125D8E; Mon, 23 Nov 2026 09:59:26 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 0B2A72D28D; Mon, 23 Nov 2026 06:59:23 +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=1795417162; b=i5es+RhrccUoOOP81hNIrCwm3EZbQ84SkR4PCJdOyJPxFqdfFblLHBXrWeTusPRYH/9A LKXtbEowfYHRzA03DYlUbOtR6FVp17GMmUV5GjKsfa/5K8xO4349hmmai5mmA/CDxZ+Gy 5AcxHNtb7Qp6cQU+LqvZhoN9SnSBVS2buKbwz9E9+7pIgjTvBnQ0umTZigfiFXZr107jm 9QkeWX7hf/c0/jnRvRWGkn8Qm9BzIdJ6zSflNo7NDP9an4+pcZYY426+utSLgWWFLxfsf Yu5YPGItsXv6SfVJLbWMyvCaXuN6FHVNyAgIrJvBFINlt6CeWFkZa+4r9xy6s2qxz5w== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795417162; h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature: X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow:From:Date: Subject:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:X-B4-Tracking:To:Cc:X-Mailer; bh=4uGLmKkycWhl6chDAMAVelwD0Gt3fcUfCq1dLiVMmDQ=; b=RLhaZSTzlbVvMzLJrejK19cWA+fHhrAyxCIf3agGMA0GijE9TTcensWAFg0VAmN9r/Iz JEkFJ9mWdFUYVo9HnCPBJsCaj1QepxaugI/sZkYcV5ys0sNIhfQ0r3m3GQYZXILWRGZcA hoqEAUsH/bOu5qLGh3D+X1QLgR3BECSPVVE2LrjuxaqRpIXfvYUdD0qeeihh01KQTALC7 ZeK7zFUWROf2hUDjMS8IuqoPq/26mt+xXQ+FucTmkyZ5oHGHh+ZmxB+DnNbJriqju3FXy rFzzUlyXKL4TqR/VakIUpTnYxRd0naSfg9Z+99oEeMvDMwPMcPbaK4MAgUtGchTec2g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DZE6bu6G; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; 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 9C1F7606A32C; Mon, 23 Nov 2026 06:59:22 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DZE6bu6G X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.104 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795417161; b=w1WpTP2sH1LWz7QhdJSwtpasmHJhWcWuo5X75uqjajaPmkjJsuOdrNouSqFOtBpOX9DL uc7ikZ50fu0osZRnVxs6H6JmtpCgq/vgHgQIfhTXeDYQqLgNf7DSR62o5OJtKFVb7eoAq y12u7hIf8f/vdb9ytorgU8nCW9u47rtws+3i/6W1WPX+Q1g+eE3YHW9JBAdtkqRNNH/Ww aoUnPLhT4o8P8nA6ZqjIk/2/Pub7ljVthsncfndIHHy5A1oJn10uktw42n39SfzouEtgA WTQWUeWj+gx8JFUzoFkwpm7fBHqp7hdCzR7KdlTzvAcUYKBklZzvhqbZ5ux/bG/xU4w== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795417161; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking:To:Cc: X-Mailer; bh=4uGLmKkycWhl6chDAMAVelwD0Gt3fcUfCq1dLiVMmDQ=; b=LWx7EzYQqiGt1+64SjFlPpSs2dXuF1tLP7HGknfhhvdGpRYSyERerbE4IyCUwrG3hLhi hlVvZftc+ULAbAFELcDv8eq/BKUQIU/ImHIuYZ6g5qfFuVf5I+ed0Kzzu9e5nQKAkgEEU xKPIVAdIo3b0Etd0xKQlrDxxl7GnXMzQonQG/ZHf7t5mGVpEPrsUqweaHrmQbSxc9KRF0 GmI1fVrGZGAVCLkPEqF58PRV+x5zcUZQMF9pJ7JBk7/bgsreBPYlmiYc3zK3ONv1Xhmd7 JQSBWAhlQS8+wwfdMqnMdSgX1YNUun8KdwLwuNe9twc6MfV6aH/NgOjqdH6p0W+xStA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=DZE6bu6G; arc=none smtp.remote-ip=95.215.58.104 X-Received: from mta1.migadu.com (out-104.mta1.migadu.com [95.215.58.104]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D1A45606A31A for <netdev@vger.kernel.org>; Mon, 23 Nov 2026 06:59:20 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D1A45606A31A X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: netdev@vger.kernel.org X-DKIM-Signature: a=rsa-sha256; bh=5BYI7kxo6/z6iVE9dme+tMD5IW7QULhAbKDgXKjM+8w=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1795417158; v=1; x=1796021958; b=DZE6bu6GbtYB1djj4tTfRx8SceDRrvR/KI4lMMWXbEAUourXx/zu5We7c7ZghvgPn5jZVVuT ECdPyOT41Y8ZvNMrDSVvuN3RTq4rHczHxRQCIdTLA2HuM8n4GwOQjTEC4VUpDJ5iyOuamD2SMHE V3UULROkldmzfN4R+R69pVMA= X-Envelope-To: netdev@vger.kernel.org X-Received: by smtp.migadu.com with ESMTPS id ba276d915217f0c6; Mon, 23 Nov 2026 06:59:18 +0000 X-Mizu-Trace-ID: ba276d915217f0c6 X-Migadu-Flow: FLOW_OUT 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-B4-Tracking: v=1; b=H4sIAEDkA2sC/x2NwQqDMBAFf0X23IVuCqH1V0oPafLUpZJK1oaC+ O8Gj3OYmY0MRWHUdxsVVDX95gZy6ShOIY9gTY3JXZ0XcTd+/0bOWFmX6jnZynFC/HDBjGBI/JC IAHHDHZ5aZSkY9H8entREeu37ARtTUVl2AAAA X-Cc: netdev@vger.kernel.org, Qiliang Yuan <qiliang.yuan@linux.dev> X-Mailer: b4 0.13.0