🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27147

[PATCH net-next 02/10] mptcp: pm: don't drop an RM_ADDR behind a pending one

#27147
From: "Matthieu Baerts (NGI0)"
Date: Fri, 04 Dec 2026 21:44
74 lines
11105 bytes
From: Josef Bacik <josef@toxicpanda.com>

There is room for one received list of address ids.  An RM_ADDR that
arrives before the worker has taken the previous one is counted as
RmAddrDrop and forgotten, although the netlink events for its ids have
been sent already.  Two options follow each other at once if, for
instance, the path manager in user space of the peer removes two of its
addresses.  The subflows to the second address stay.

Add the new ids to the pending list.  Only the ids that do not fit in
the list of MPTCP_RM_IDS_MAX ids are dropped, and the RM_ADDR is then
counted as RmAddrDrop.  The netlink events are not sent for the
dropped ids, and they are sent before the worker can act on the others.

This issue has been found with the help of an LLM. It has not been
reproduced: the second RM_ADDR has to be processed before the PM worker
gets to the first one, a window that a Packetdrill script cannot
target. This fix is based on code inspection only, which is acceptable
here: the issue is clear from the code, and the fix is simple.

Fixes: d0876b2284cf ("mptcp: add the incoming RM_ADDR support")
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
[ Commit message: only the ids that do not fit are dropped + how the
  issue was found, and why it is fine without a reproducer. No netlink
  event for the dropped ids. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/pm.c | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)

diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index fd8dc1132ad1..dacd3cf358f5 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -843,17 +843,30 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
 			       const struct mptcp_rm_list *rm_list)
 {
 	struct mptcp_pm_data *pm = &msk->pm;
+	bool drop = false;
 	u8 i;
 
 	pr_debug("msk=%p remote_ids_nr=%d\n", msk, rm_list->nr);
 
-	for (i = 0; i < rm_list->nr; i++)
-		mptcp_event_addr_removed(msk, rm_list->ids[i]);
-
 	spin_lock_bh(&pm->lock);
 	if (mptcp_pm_schedule_work(msk, MPTCP_PM_RM_ADDR_RECEIVED))
-		pm->rm_list_rx = *rm_list;
-	else
+		pm->rm_list_rx.nr = 0;
+
+	/* the worker may not have got to the previous RM_ADDR yet */
+	for (i = 0; i < rm_list->nr; i++) {
+		u8 id = rm_list->ids[i];
+
+		if (!memchr(pm->rm_list_rx.ids, id, pm->rm_list_rx.nr)) {
+			if (pm->rm_list_rx.nr == MPTCP_RM_IDS_MAX) {
+				drop = true;
+				continue;
+			}
+			pm->rm_list_rx.ids[pm->rm_list_rx.nr++] = id;
+		}
+		/* not for the dropped ids, and before the worker acts */
+		mptcp_event_addr_removed(msk, id);
+	}
+	if (drop)
 		__MPTCP_INC_STATS(sock_net((struct sock *)msk), MPTCP_MIB_RMADDRDROP);
 	spin_unlock_bh(&pm->lock);
 }

-- 
2.55.0
Technical Details
Message-ID: <20261204-net-next-mptcp-misc-feat-7-5-v1-2-1449de51adae@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-377651-linux-kernel-netdev=dewy.ru
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!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-377651-linux-kernel-netdev=dewy.ru
From: matttbe@kernel.org ("Matthieu Baerts (NGI0)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next 02/10] mptcp: pm: don't drop an RM_ADDR behind a
 pending one
Date: Fri, 04 Dec 2026 22:44:34 +0100
Organization: Usenet Network
Message-ID: <20261204-net-next-mptcp-misc-feat-7-5-v1-2-1449de51adae@kernel.org>
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="2878237"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:FEYvAofLbSWNjr3feNXSWFMygjo= sha256:IgzDwIZZ+r6r08opfCJhJO7i2pNP2vtHqfdrHRSzBzY=
	sha1:32rT6MHSNa6U+9Am/5V5KEclpDU= sha256:boa6LHclwpLdwEfLGGbwZ4keZoxhDG3OV24BTI88AVc=
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 D6FFF117CED; Sat,  5 Dec 2026 00:45:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.542
X-Spam-Status: No, score=-3.542 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.142, 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] 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 Pliy2_XQpbk1;
	Sat,  5 Dec 2026 00:45:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377651-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 52D5D117CF4; Sat,  5 Dec 2026 00:45:11 +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 91AE828E92; Fri,  4 Dec 2026 21:45:05 +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=1796420705;
	b=Ee6wNHKL80pygAFrvXwTEH+/929MbsINpyhj/zLN5bhgkcivZO5XHni321Tzjx1W6gwx
	 4XEiz56SkHLRweP9h0IxOawlMhBsiI8sNJ8D4tox0pO2jDZc3g19ZA2zvh8awpsso4ONz
	 9EwFTpfvzjK0DWxKszEoyYLTe9nErMyMgUeFwztn3EmVpKE//PuEjB72pLze2e/ob533j
	 290CwZTFG9c5qfJ4lMU1oAfm7aRb5SovX6CQgcBIzRsG1sBHK0ruEF3V2Aj+Ilgrbpxw4
	 ClTll9qMOUtVDu3DssZleHqAv8TRsMzPJViDEQgeLLBdwYNMi1kxeuRn4C3lxrCyJVg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420705;
	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=Loq8+cRbV3aoRy+GdawIQ9xzFm0ecw/0yOPnLtLm8/s=;
	b=wDy9LCnjdK1pAorkWiQMb1VwEwz5iZl9OWNsQs4ISqKg2heglF0V3lMwkhhFc+fD82EZ
	 U0A+uo4zya7hHNqP+OTlSZp/ggWr+SpoyzTVanaUHXppTmjEBRLUfm/wNWzFnMBDkHTZZ
	 p/Yb6VlimeHrVsyTMy/Z6o4IjH82l2wIU22WPjGTnni2oB8gqWTdO5A5nNSxOg23btTv7
	 wieJRmPOrESuESlWvy1AtGoBYBmhukNG5JV1TvMluu9kmIz9nWNgKMyv9kN/m383XQI1i
	 A4ajFy3qT3xM4WIXfgPwnI81TrpFAOURdjByIUHdaGgD4juC8CW6nf2+9ZBN/VG6flw==
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=Xip9BlsF;
	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 6ADD0606A338;
	Fri,  4 Dec 2026 21:45:05 +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=Xip9BlsF
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=1796420704;
	b=gkO3GTcsFI8+vIE0p827SE1F0zf5/oGY/agwYrHfrfsShRDbgNeT1arRfmqqW6etMmxC
	 OthojkrVsYdJ/9WYW5gA5NZRtAt3hRe/2YHaDv8qrX4QGn88V6AHjbMyBdkGSZARo1Pij
	 wPpCoIXM+8mVs+1FRvlNg3MtUema+s+J+o7va17P2tJUnTJ+JzCwN6n8Otlzro/1C+pqF
	 dXoGhd5+t3RwvOWLOwOYeMw9qCfGQpxACmxwks2+yJ1SFN+v74LCx5ToU9KmaA+kCPsKO
	 jqY8xhM6kcKXfd1zfu7BlqdP7SgQErCteupkutkmUWxdEo3SLs53C4bWE1qOcBarJew==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796420704;
	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=Loq8+cRbV3aoRy+GdawIQ9xzFm0ecw/0yOPnLtLm8/s=;
	b=N5UeUX9zrGfFZX8Fs+MQX/WP2AhOu8j51m65wIxpoZXl4/mwOTo9xJ//4UAAlQp9eTEL
	 ldDzMtWD8yGcS/lNEu+e4+gnl0b5wRyx1SPf+RolJI6FoRFON6Kd9geg4/vr5Q3FmLjqD
	 AMkRrgceOYCaLG7QRlAGij9WraeWx2Xv+3O+KXZlQe/nrd9peTshqFgCJCPPcaT1FcLNu
	 YMU92ZrK/lcXTdeGyZRsv78Fem447zfv/UhxHUsaoq2Myc6nBpggqd6nM2rhmJWdHzUet
	 LrRWaxnxNHDYdCB94V9nDN6rZudRglKiP93/t4YUkL1+SKyNFlxhFXbszF7+I7Mxlmg==
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=Xip9BlsF;
	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 8C9B0606A680;
	Fri,  4 Dec 2026 21:45:04 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B04C01F0093B;
	Fri,  4 Dec 2026 21:45:01 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796420704;
	bh=Loq8+cRbV3aoRy+GdawIQ9xzFm0ecw/0yOPnLtLm8/s=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=Xip9BlsFSTYPoZGXmJ+Kb6Nvis/fQ/fn6H3E6igaknsKZ0sxpphar+xlD3nNa+jio
	 qdEXdRZvg760j6l8IIhQkdQApHj40nbDTLFZAioPqYZK5z8pbXqRr6B1Usy9H9Ny+8
	 LVOReJA1J5nfOa3Y5JA63ykP6ZLHeb0JYIGKoTYozoeV/9IfZ+sXo+PysrLJ2ueSOo
	 VNTiNoQvijXRAN0STZK47zqe1ZxHU0s+UCBV7KlLOYw5aLh2LS9ZWT4pIheMuJRb65
	 883Iagc/OPaVG1wcbiDjMkmKB7cgHnDiZZq0RkK41wdgX7UsyykZz3J8d10HMrlmTs
	 wIly2dq7JqOwg==
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: <20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae@kernel.org>
X-Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, 
 linux-kselftest@vger.kernel.org, 
 "Matthieu Baerts (NGI0)" <matttbe@kernel.org>, 
 Josef Bacik <josef@toxicpanda.com>
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=openpgp-sha256; l=2728; i=matttbe@kernel.org;
 h=from:subject:message-id; bh=CJQkf9uHHQxTARZ+7CHnkDN8CIfJdLD4qAK19G842DI=;
 b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLKFTQImfqi0sSw/5hWQI/3kfQZPapVdt/OlFe+lA5l+B
 bpeVrLuKGVhEONikBVTZJFui8yf+byKt8TLzwJmDisTyBAGLk4BmAi3HSPDfPlDHkUbIsrZ01gV
 JCfNvM4zvX5foqCBUpNeZrL5zwVGjAwPXx9n/HrHSS0vzDo/5GMZo9PK+Gm3Zf/sMM1X+TN7hxs
 zAA==
X-Developer-Key: i=matttbe@kernel.org; a=openpgp;
 fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073