🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25971

[PATCH net 1/9] mptcp: pm: kernel: c-flag: keep local_addr_used in sync

#25971
From: "Matthieu Baerts (NGI0)"
Date: Wed, 02 Dec 2026 21:29
56 lines
10513 bytes
The ID was marked as used before incrementing local_addr_used counter
when the families were not matching.

Marking endpoints as used while they are not can have an impact on the
local_addr_used counter when endpoints not linked to the initial subflow
are removed -- CAP_NET_ADMIN is required -- and active connections have
such badly marked endpoints. In this case, the local counter will be
decremented while it shouldn't. If the counter was already at 0, this
warning will be emitted:

  WARNING: net/mptcp/pm_kernel.c:1080 at __mark_subflow_endp_available+0x46/0x50, CPU#0: a.out/149
  RIP: 0010:__mark_subflow_endp_available (net/mptcp/pm_kernel.c:1080 (discriminator 2) net/mptcp/pm_kernel.c:1076 (discriminator 2))
  Call Trace:
   mptcp_pm_nl_del_addr_doit (net/mptcp/pm_kernel.c:1112 net/mptcp/pm_kernel.c:1227)
   genl_family_rcv_msg_doit (net/netlink/genetlink.c:1114)

The fix is easy: increment local_addr_used similar to what is done in
mptcp_pm_create_subflow_or_signal_addr() for the non C-flag case.

Fixes: 4b1ff850e0c1 ("mptcp: pm: in-kernel: usable client side with C-flag")
Cc: stable@vger.kernel.org
Reported-by: Yiming Qian <yimingqian591@gmail.com>
Closes: https://lore.kernel.org/20261006114409.117190-1-yimingqian591@gmail.com
Reviewed-by: Geliang Tang <geliang@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm_kernel.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
index f7396628490e..d465524902f0 100644
--- a/net/mptcp/pm_kernel.c
+++ b/net/mptcp/pm_kernel.c
@@ -584,13 +584,15 @@ fill_local_addresses_vec_c_flag(struct mptcp_sock *msk,
 
 		__clear_bit(local->addr.id, msk->pm.id_avail_bitmap);
 
-		if (!mptcp_pm_addr_families_match(sk, &local->addr, remote))
-			continue;
-
 		if (local->addr.id == msk->mpc_endpoint_id)
 			continue;
 
+		/* Increment before checking families, similar to non C-flag */
 		msk->pm.local_addr_used++;
+
+		if (!mptcp_pm_addr_families_match(sk, &local->addr, remote))
+			continue;
+
 		msk->pm.extra_subflows++;
 		i++;
 

-- 
2.55.0
Technical Details
Message-ID: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-1-9f03efcb1a17@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376061-linux-kernel-netdev=dewy.ru
References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376061-linux-kernel-netdev=dewy.ru
From: matttbe@kernel.org ("Matthieu Baerts (NGI0)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/9] mptcp: pm: kernel: c-flag: keep local_addr_used in
 sync
Date: Wed, 02 Dec 2026 22:29:31 +0100
Organization: Usenet Network
Message-ID: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-1-9f03efcb1a17@kernel.org>
References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2065720"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:A2QDj2rBBg4diy7MuWFf6gdmDhA= sha256:9A6nhzTmEwOUYlREYXE/vhxYR/tN/yN5ZFHM7nKJrMA=
	sha1:V+gXWyeTt5AiDFHbihn9PN6kmzU= sha256:ZG2znpvGMDf1fFNbEoiAgpkksqE4+/UrqX+uRmk3yeU=
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 B452B117723; Thu,  3 Dec 2026 00:32:13 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	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=kernel.org
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 XRyGBFj2lrxy;
	Thu,  3 Dec 2026 00:32:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376061-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 074D3117734; Thu,  3 Dec 2026 00:32:01 +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 E0B582AE63; Wed,  2 Dec 2026 21:31:54 +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=1796247114;
	b=QK6zc8H62IJtQ12KWubD1IR+BCi6BCAl8jEW/0IgGYP2KEeP5wGvSi4WWl5T3WhFDDAB
	 Dx74J7PGin0950S69BQ0r7weoYO5qS4W7HnBntfzduXSmBdo6IbhUKdhiDf26Guf+aThc
	 pmbHZ5XA+JcnW7tniuWYkpedVGbxIZUcdK9wIsa/XIjzTildEiiCVUXJ9YoK8MWtzeQlg
	 Wud70KdGRCY5S95ROzcpbOMfwQS53wVW3YEulEPeJmlHdmX0QFaeM/oqkOuFrPbGtLph5
	 YMCrSjUNq7iiWMFjFAoZHPjDQCUpvmfrhwH9gaytFjT9FtFq6FFv3/vKsulcwRMdShw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796247114;
	h=X-Original-To:Received:Received:DKIM-Signature: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:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=VOq1vfguNf6VeaqPdOIz/hfpWVdFyxoYXzvmKYeoLr0=;
	b=jGWDFNCX38BHTDqb9peNoBRmE0UcU9ocMB7bXYo+ALgFuM0jQgi1srz1T1SyAa9ftz83
	 oFnih9PU9INIkDfjrLlniepTb9ZkqSpft2yxM+uh8bpT6n+f5OJ1EOwtoRzo7As4kkS0Z
	 dRLPVMNavGNMYuRepPfMc+Nc+w0qMLQGFshVNge9A/6nh+A4Ujr0eC9ZLn2wErjNJKXjl
	 VXzTUNsI9A4NdGHDxNOcpB9mfg0DAPtQPOZBvsfqi0MGHWCF/9chOlfMKMkfsttTamSZ7
	 cNjeFUtkkqtKY+WvB91kikQgtnZwLOsq+R5+NnI9CAK889MGX4wyKk6LATCsF5kmDCA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aehf7xbF;
	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 B6EC9606A337;
	Wed,  2 Dec 2026 21:31:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aehf7xbF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796247113;
	b=5p6PxLxRI15FJV5a3lLtO5rrMBKCMtDuGh5+rX7VCV4VnNGEXXDH9i4P0KFurAVYpK8R
	 c2oaZ6hsxvX7zdNNvpoFK065H+/PNCN34DOIkYhLN8SV8dfj14DRrTwbHzP0zbNTIXiBP
	 HyJCBfiwJMP8yDhgbYrT3iIR50hYDrF7CrWs9QqHHaddEtb6hWQ6llHaPRcBaP4ONyCXQ
	 O3zhvn7OKJDFkPb/b5zBwUfeNh5yUtQcEuYC4XOXEUW0soIP4kWTZbBwsstAcGoj6J/8K
	 lRprvUIziy+8j4rpqbsFxnIH8UQeDUpRqqrWoM5Xt+ZuRu/8OIkcdN0npuhMClz+4qg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796247113;
	h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type:
	 Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc:
	 X-Mailer:X-Developer-Signature:X-Developer-Key;
	bh=VOq1vfguNf6VeaqPdOIz/hfpWVdFyxoYXzvmKYeoLr0=;
	b=RsGMNY5y7UocanyiV4ce5Szi+4H3PunGAMcYwBL4uzxPjKzkBXfQp+yny/TNNQqS22t5
	 Cac8tfXWKB6uu7ieOr/RlJyihPmP73YcQiaDKNkuczuqD64ORTRxsCbBSXkkk3MsfsxVA
	 pX5b56jQhn8lizwfAU4CXuquAH/wcxzMxmGWxteN38RQTdiGYEn64ttlfpKXHDQbZK+yv
	 d/QgoTLp8zlrGBY0Aug5kkV6+v1wMVFr4qjgPQaiMNhvLOKQaybvA52p3lwBF6W8AxV4K
	 dFQbEwjUT6fw58PuLNtt12Y/wNaWFLZKSLwgUqnMO4aE3ksWALSC3xGxPfsiY220YoA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=aehf7xbF;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7D5B606A322;
	Wed,  2 Dec 2026 21:31:53 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 146041F0089B;
	Wed,  2 Dec 2026 21:31:50 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796247113;
	bh=VOq1vfguNf6VeaqPdOIz/hfpWVdFyxoYXzvmKYeoLr0=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=aehf7xbF1MH6i+oTvFbZzamfVdYe/+wo0chq29qNzMoZ0SkZWvhq8ZbZPD4yyOX9E
	 89Ku8wQ07hsisKWepXBz720v3vAM6KHJhgpKdXn9YAMXTE7wiRbwgYxjSLCOvo26wj
	 in/I7xC9T8UiVsEKg18KTZqB2fM+QsjLWk4rdsgZTW3exL6y4Srvzj2dXKtcmA1wC1
	 yaaSbV2vhZc9iQxGnltpxZjpX5X+6aZMTUMJx6TR3Obk+SCfI661808JbuMVMYw4ad
	 Dj5gvAveEUO7YrmnIC2AwC65cALp5zOB+TIlnTfZOAty7fHSdhd2Y0b5O9ze1VYBNA
	 fssV36M4b/1AQ==
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-In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17@kernel.org>
X-Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, 
 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, stable@vger.kernel.org, 
 Yiming Qian <yimingqian591@gmail.com>
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=openpgp-sha256; l=2171; i=matttbe@kernel.org;
 h=from:subject:message-id; bh=axcgn9bBC1LrGiL7ZTisRxYm/d9b66nYFjptypHpUzE=;
 b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLIF+mwcV4ffieOfedGh4c2vXtNbV2f3cfxIk3omuavoO
 tPWvw6uHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABP5EczI8Cs5MrY7K+3iQRX7
 Izs+PN04ff4rN5Yb+zM+ZBrN4SttLmRkaGF6eLC8zuDixX8lD8oyXqf0/fN4wT3BKCH+Z2Gf5JN
 7nAA=
X-Developer-Key: i=matttbe@kernel.org; a=openpgp;
 fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073