From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.181 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795911471; b=wNbNI7X0eFJPni3GeWU8LQPkNP3UO9HoTVVWrv/If63VFbEAslOKsAfANmgbBQmLEj6d fsY/Yk9ySWAxIM2aA/pFjTWRNNIfCGSTRH9Bya5EZnxMivknVy8qt7OwhKM2WeF8Y6IK5 xsPo+TA+jfYqPeWLcA6ZBgaM/PMa/RdZbXeJnKiZJTPZouGGGgdXgxpAw1ZjVIc0g7+cM UykqS/s2fB3o+wZi2wyk4FlPKsAM8m8qOc8srPkGx0d9jV8sx2fuMtti7wadgyIINBDzR EMknTgLp9hoPPT2fZGije5K/VypHP3XZePV8LEiGNLTjPXWE8rDqkHVk5kMhTMFUCAg== 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=UqhFoyNKhDsHiKYiYyQwmeqoM9ZnQ2i710MUPzduCXfEgsJferWKtWB9EFgjjFvMu4M3 A6Hc1NcqEOMTWb0zCu9i8xgBl99ccDdATfCYkDA1v8ayX8cvhEeJFzJajJ3eIS0bbR0zJ GzlpAZyMOZvwFt0wP9o6LaYLyTYMyB9Q+IFZQEbb3otoZ7QEfpZuriIiuLL05Jqg77BqW k27pszVxT4MlQmKFZ51M83I4bUKvaCfaVyFMJOElcD6tEf/Y3rYzHfDKTStwAfSbHYEhG KXHEp31tfbUcrpclYDvCTXhjlRctVl0HVKlZnU6jmkpwct/RKONMSyUPCEqO0MV+lrA== 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.181 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (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 BB7C9606A323 for ; Sun, 29 Nov 2026 00:17:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org BB7C9606A323 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-f181.google.com with SMTP id d75a77b69052e-55d2dcbb905so66185441cf.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=N4Aq3JGj1h1RxOMi+X6m8X9Ey03acsKlznlAXAUBjcoPSmBylfeal/Qfjlj0CxACbA RppQppSr40/1IfNZPj4OZl5qwwEuRtubcEQOLNarBpN60WOGEW++TchEibrNCSU+rD2o CqsN0ldyxSn8EnE204MkTkqtr/53svVIabSeEDSaxLIc6R7OOoo9me1cSRqUCLtEcPx5 wmVW0vIgrfBJ3O7Wptrq4eQEW3UnD/0XN9Fn785OncfqiBiu7PS/WVjNU3Xy5xTIr1vD yD5y4pfbVJ/7LQO+Wzq4ojLWf9n5YVqlazqB2Bl8zV6ae/F+FXDNOoEiZ0bNOnFfTYLO Yo7A== X-Forwarded-Encrypted: i=1; AL+hErEnjtUIR7rCF2xCPAcMo+PFreqObsqXALz4sfsxGzvHkD0I74U7BVZi7TV1fgiHX1ZhhCI0wJc=@vger.kernel.org X-Gm-Message-State: APuU4Z8kE7NR+bO2A3wHXBQPXUgkjHSTZclu0i/+lM2W0DQhxpdb2USX yA66PxMynNi14As65TPlg6r5KJmxTE66+0YgaT4jr3jFBvLPoSWcJ6Y+H8MWppxbrNA= X-Gm-Gg: AZFdTZeTuqHTT63fArHlo9MM3SwJs124M5rhmOWqbe+byGP0mAsBTPn/0+7SZZZeK0i 2dWdcNT3v+j5ZFK16nTzynbnz+GY1M7UaWDhmg8PIQd96oHF24QOvJdX+Ph2b4GKGIyLkYWFJG8 5EdAeMnXVPUyjr9Ql5lpUOSLH+1Zdo0OPmRR42RyALfGe2pRQvhxPdGZ4euDVmaDvwGr9fm4HOs 47f28t8dlzi6HDp7DpHNmNtzUeBqk95Ar3Fcy5kO9aNXOkW9+I0PKhWlJXI0RwqXNmIK4LeVces B22zhdk54lhURb5heNjNWGby+BNOzagXQdkmxGTT0cA/72QJG3sKfzuHqqf26JRKBg6n9QOfjPQ EV6acJtvUyeTXCxSZZrXdLaXohFv/hPcRIxJBB00UYQOKPOY6pumE/ZmipAhWxN8n0R9kOoW8Mw zpoRtjxcRQFhKi8eHsFjiVvOy/EzI2QzRfESR4PbXOBHfNSRA/teaqdm/+IfR6sqd0V3Jowbc/e lUxXxAx5yCjiJnGx/+UxBt2lB1B/9z5C800vn21Rcnwr0cOYLBUavbsxeKoHMdZ+A65D8SLRopH uPfzOgqkO3tVosG3tcaJ31o3rcgdQcURERef/B7yw6TvyS+c8+f/cBxL6sXO6dYBgSjVK2dnz+r pKA== 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: netdev@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