From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795911471; b=QUUrZ0kUBHnY1s3RMYaQeHfwzAjb8u+1WlJoMlmjIvgIxMlNNkRY29ADlO1P0iG5Y7VW xsXUaMg1zEMoOYvA76wKC44VCmRgYZYWHBUO/XmVDBaf11PhVSFATBBK+OCEA9JNHpR6P XN8JFyuP5sabgE9wb/+uu3G8wmUhpMu7YBhlk1JVYJzfomUAg4IWsK6eFkIxp59IRHe8T qehZ1EnMyzRFGXPw/xrbMTsy8aBGOOVrQC3NK4/zTCaGbjrFr4a47xwjggx6nb9cedZoC SG/LjGmJHYL5n9jvkP8dLZs6qQkuUZHINg+kC/WGJWLWO2Y0KXZgLk6bJjc9b55/8/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795911471; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=QkSKNkkQfjzuhLdx2/cwdiwym+9gbLLxKCUNhLEufkI=; b=rklWXNJ0nkseTIv6Bv/lBL4tXGPQ2m1w+uCdECFIeJbzVT7bNh8O5f1K0/NqeTDGNhTY qOPpu4csqP/xFI+sgq16XyOfzP4SZxHoqKqYcIkzTYbWJFVeTHIVIASeTwzHoyO4YPMdq U72kj+MIwNx3A8V466VsRnESOe3WRY7KPO/9gPPc/0bFW3zYATamCr6vO84lXamXVge28 cbOyuWWiw6bF5J0x+gQg+vcC+M7jn9/D+LW3p3JtGqTeNcxgIIXM93tZ+FNCd7c4fLeMw vBPEon6BsFLe2Wh1MUvBe9XYaXZApVjDUeRP7wd22Bm1eOydMJI9Rrge8T6Ft3Gjpmg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=stellman-greene.com; spf=none smtp.mailfrom=stellman-greene.com; dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=UVDyQ3Kb; arc=none smtp.remote-ip=209.85.160.182 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 E154A606A32A for ; Sun, 29 Nov 2026 00:17:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E154A606A32A Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=stellman-greene.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=UVDyQ3Kb Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-55d2dcbb905so66185451cf.3 for ; Sat, 28 Nov 2026 16:17:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stellman-greene-com.20260707.gappssmtp.com; s=20260707; t=1795911470; x=1796516270; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=QkSKNkkQfjzuhLdx2/cwdiwym+9gbLLxKCUNhLEufkI=; b=UVDyQ3KbYg8Wyrk224GUS8AdToJun3tiI0Mqdr4ZRBPunOcIf1HiFx+nI+6TR2DhTs +zOajVDlzSU5+3did81oaTOz123QBeLzlWiP2f1GgqK/vBjnhXcFqM4BYRmtJVbVlJLL /2NEG/3p/jAEe/Fx0K1jzs2Pej5xPYr5se/rwTM4EEP6gHE1LK0jmLZ68m+KZRoRNxoD IuPAgLYX+itSI0qZiK8CterLOF+oayOkOPCVVpz7ShJVBBKu03HCGWtUjak94IKN3WRX wGbPsbfHaGd/YG4sklrWyOgyG7TIdevV7tgfj/f70c3DBAGzvtwnEB9g9aoGFKsZpcN0 yPLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795911470; x=1796516270; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=QkSKNkkQfjzuhLdx2/cwdiwym+9gbLLxKCUNhLEufkI=; b=LoZHZdHdot0ZbcS+jfFIKK9nk0nZKKYDa7PJi5Y5vE9L9irxkM8hbRLNVuk4Y0RnUj B3FLKgbUfgSWnm01kwGFunIe2rp3M9AYWV33PLB3I8vMENL/AwRxN4bFCy6oFZxj5uw+ gyMhcnhw5/ptMTA0TDCSifJdGeybHN7M330FrX1UGmAFGyolpKCVPcs965xuRieGoDmU jt4McJczvRDCcJm3agcmI+Ly3ZUh+8+XJ2NZ3bQltzEkMlxTsiPFObwVDUje83YH9XbK dUDxCpnYBp98xefxPOrbXen/dJ24O5XzzhYCTb2F8qQ6ekNS/8kbpFa4YqCnewzHmss8 Va7w== X-Forwarded-Encrypted: i=1; AL+hErGToMv6bXIk9d6q/TyvljuJNJVEV8CavqMrS+bIZKQF24Efpd96F9uoaqZafVXEHFzAcd5YpBZ9LeOEL+Y=@vger.kernel.org X-Gm-Message-State: APuU4Z+o9OrcPEhik7JuficNJyPzbqVbXAewfJu1Ai3d69kegwYasEea JMx+1mWBt2KxNh8WMzZhkQXyjBQQnIh+mqbQNuc/deBJtDiVcfBr7xEUJB8O0ulVSmU= X-Gm-Gg: AZFdTZct3ZE6x/MSZZeEuhAW4xwzpUJE6qsOCiJrSUkH8Suzu+25WL+0M7BgDlxPHp7 5nv8Fw9uSCXwvEoQY4A7UTHMYMpi2A7urHSEzV5QzzPMvATne5HSanowYtS5QZ9hILDqllU1c91 6VPuvT3U9XDMu5MPM6Ug9UAZZi9FC3HVkJvEbgWUrr6lCpJWllTJMNhqB2cLt6bzYHHURGaT0M1 ynPQlxQ45xc5NBJp78xLpE+D7xSps/kqt0Sopnvq1G/hyHPYAtcgBq1adasTuUZazuZjg8ikHHG fseO/QIvyHT10gmah2HQKnJa0sbRvP1T36UFAVsIjtMLuMuGzAYob/U6lIlCKEKLazCfU9l15zG i12DBPpZKhXRfG/Mb0E2WisXjx6bjrQMjy9FZWZk34586gD1Pk4f0u3HcocSXVG5A2qe/MpObjA 0qr5LFdc75JfXswvheAh9gv0GmB+gVE6KgMPi/tuRV0Cw38GBdYLtsRpYurzlu8s52WdY7kRjt5 6pV/SIHbC18KuQFtRA2raLNs7/Dm/awhz6BRSPzzU103PFht1Jky5a8V4CoBUJuJxowjKaZwQu4 YfnDbts/z/a743PKBKxKpY3THRWlVE8zaBbPNtyWv+o3Y3cS09L++z2TeBisumoMDv1QES+iV/X 7HA== X-Received: by 2002:ac8:5d90:0:b0:55d:32ed:38bb with SMTP id d75a77b69052e-55d76a5af68mr551863811cf.42.1795911469737; Sat, 28 Nov 2026 16:17:49 -0800 (PST) Received: from Mac.mynetworksettings.com ([2600:4041:5c28:200:3c29:a645:a023:b4a7]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-92134796288sm251364716d6.6.2026.11.28.16.17.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sat, 28 Nov 2026 16:17:49 -0800 (PST) From: Andrew Stellman To: Jon Maloy , Tung Quang Nguyen Cc: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , netdev@vger.kernel.org, tipc-discussion@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH net] tipc: don't update capabilities from duplicate discovery requests Date: Sat, 28 Nov 2026 19:17:48 -0500 Message-ID: <20261129001748.78733-1-bugs@stellman-greene.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andrew Stellman tipc_node_check_dest() calls tipc_node_create() before it classifies a discovery request. For an established node, found by node address or by peer ID, tipc_node_create() overwrites the node and link capabilities. A request that is then rejected as a duplicate address has already changed them. Because of the peer ID lookup, this also happens when the request carries a node address the receiver doesn't know. Look up the node by address or peer ID first, as tipc_node_create() does. For an established node, do the peer net update that tipc_node_create() did at that point, and call tipc_node_create() only after the request is known not to be a duplicate. New and preliminary nodes still go through tipc_node_create() first. Tested on mainline (7cd8495c0f16) in arm64 QEMU with KASAN, replaying discovery requests over veth between two network namespaces and logging the result with a test-only pr_info. Without this patch, in both of two runs, a duplicate with the peer's node address but a new signature and media address changed the capabilities from 0xfff to 0x1, and one with an unknown node address and the peer's ID changed them to 0x21. With it, both stayed 0xfff in one run. In all three runs, a request with the peer's signature and media address still updated them, and a request with a new signature and media address sent while the link was down was accepted and set them to 0x1. KASAN reported nothing. No selftests were run. Fixes: 60020e185704 ("tipc: propagate peer node capabilities to socket layer") Signed-off-by: Andrew Stellman --- The issue was found by Claude Opus 5.5 and Claude Fable 5.2 running Quality Playbook, an LLM-driven code review tool: https://github.com/andrewstellman/quality-playbook The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with Claude Opus 5.5, and both were reviewed by me. A reproducer is available on request. net/tipc/node.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/net/tipc/node.c b/net/tipc/node.c index 53b0993c2c2333..f0e3e06ff8c7bf 100644 --- a/net/tipc/node.c +++ b/net/tipc/node.c @@ -1176,6 +1176,7 @@ void tipc_node_check_dest(struct net *net, u32 addr, struct tipc_media_addr *maddr, bool *respond, bool *dupl_addr) { + struct tipc_net *tn = tipc_net(net); struct tipc_node *n; struct tipc_link *l; struct tipc_link_entry *le; @@ -1185,6 +1186,7 @@ void tipc_node_check_dest(struct net *net, u32 addr, bool link_is_reset = false; bool accept_addr = false; bool reset = false; + bool existing; char *if_name; unsigned long intv; u16 session; @@ -1192,8 +1194,20 @@ void tipc_node_check_dest(struct net *net, u32 addr, *dupl_addr = false; *respond = false; - n = tipc_node_create(net, addr, peer_id, capabilities, hash_mixes, - false); + spin_lock_bh(&tn->node_list_lock); + n = tipc_node_find(net, addr); + if (!n) + n = tipc_node_find_by_id(net, peer_id); + existing = n && !n->preliminary; + if (existing && (n->peer_hash_mix ^ hash_mixes)) + tipc_node_assign_peer_net(n, hash_mixes); + spin_unlock_bh(&tn->node_list_lock); + if (!existing) { + if (n) + tipc_node_put(n); + n = tipc_node_create(net, addr, peer_id, capabilities, + hash_mixes, false); + } if (!n) return; @@ -1310,6 +1324,15 @@ void tipc_node_check_dest(struct net *net, u32 addr, memcpy(&le->maddr, maddr, sizeof(*maddr)); exit: tipc_node_write_unlock(n); + /* Rejected duplicates must not update capabilities. */ + if (existing && !*dupl_addr) { + struct tipc_node *updated; + + updated = tipc_node_create(net, addr, peer_id, capabilities, + hash_mixes, false); + if (updated) + tipc_node_put(updated); + } if (reset && !link_is_reset) tipc_node_link_down(n, b->identity, false); tipc_node_put(n); -- 2.53.0