🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #27524

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

#27524
From: netdev-bot+sashiko
Date: Sat, 05 Dec 2026 22:04
140 lines
13229 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 1

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] The fix only works while all pending ids fit in one RM_ADDR-
  sized list.
- [Low] mptcp_pm_rm_addr_received() (net/mptcp/pm.c) now skips
  mptcp_event_addr_removed() for any id that does not fit in the full…

--

mptcp: pm: don't drop an RM_ADDR behind a pending one

This patch changes mptcp_pm_rm_addr_received() so that an RM_ADDR that
arrives while the PM worker still has a previous one pending is appended
to rm_list_rx instead of being dropped. Ids that do not fit in the
MPTCP_RM_IDS_MAX sized list are still dropped and counted as RmAddrDrop.
MPTCP_EVENT_REMOVED is now only sent for the ids that were stored.

> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
> index fd8dc1132ad15..dacd3cf358f5a 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;
> +			}

[Severity: Medium]
Can ids still be lost for good here? rm_list_rx is a struct mptcp_rm_list,
which only has room for MPTCP_RM_IDS_MAX (8) ids:

include/net/mptcp.h:
struct mptcp_rm_list {
	u8 ids[MPTCP_RM_IDS_MAX];
	u8 nr;
};

Remote ids, however, cover the whole u8 range (MPTCP_PM_MAX_ADDR_ID is
U8_MAX).

Suppose a peer sends several RM_ADDR options in separate packets. They
are all handled through mptcp_incoming_options()->
mptcp_pm_rm_addr_received() before mptcp_pm_worker() gets to
mptcp_pm_rm_addr_recv(), and together they carry more than 8 distinct
ids. In that case every id after the 8th takes this continue.

The worker only copies what was stored:

mptcp_pm_rm_addr_recv() {
	struct mptcp_rm_list rm_list = msk->pm.rm_list_rx;
	...
}

RM_ADDR is not retransmitted, so mptcp_pm_rm_addr_or_subflow() never runs
for the dropped ids. Wouldn't the subflows to those remote addresses stay
open? That is the symptom the commit message describes ("The subflows to
the second address stay").

A Linux peer is unlikely to do this, because mptcp_pm_remove_addr()
refuses a new RM_ADDR while one is still pending. A non-Linux or
misbehaving peer could do it, though.

The commit message says "Only the ids that do not fit in the list of
MPTCP_RM_IDS_MAX ids are dropped", but it does not say the loss is
permanent.

Would a pending bitmap of MPTCP_PM_MAX_ADDR_ID + 1 bits work here, like
the existing id_avail_bitmap in struct mptcp_pm_data? It is 32 bytes and
covers the full id space. It also removes duplicates by design and would
never need to drop an id.

> +			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);

[Severity: Low]
Because of the continue above, mptcp_event_addr_removed() is now skipped
for ids that the peer did remove but that did not fit into rm_list_rx.
Before this patch, every id of every received RM_ADDR produced
MPTCP_EVENT_REMOVED, even when the list was then dropped.

The uAPI description in include/uapi/linux/mptcp_pm.h does not tie the
event to the kernel acting on the id:

 * @MPTCP_EVENT_REMOVED: An address has been lost by the peer. Attributes:
 *   token, rem_id.

The event is also sent in other cases: when no subflow matches, and when
mptcp_pm_rm_addr_or_subflow() returns early on TCP_LISTEN or an empty
conn_list.

In the overflow case the kernel does not close the subflows, and user
space gets no event. The only trace is the per-netns RmAddrDrop counter,
which names neither the connection nor the id.

A userspace PM (MPTCP_PM_TYPE_USERSPACE) would then have no signal to
update its view of the peer's addresses. It also could not know to issue
MPTCP_PM_CMD_SUBFLOW_DESTROY itself.

The commit message notes "The netlink events are not sent for the dropped
ids". Should the event still be sent for the dropped ids? If not, should
the uAPI documentation describe this new condition?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204-net-next-mptcp-misc-feat-7-5-v1-0-1449de51adae%40kernel.org
Technical Details
Message-ID: <179650824815.3148.6653715043111591603@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378153-linux-kernel-netdev=dewy.ru
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-2-1449de51adae@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-378153-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 02/10] mptcp: pm: don't drop an RM_ADDR behind a
 pending one
Date: Sat, 05 Dec 2026 22:04:08 +0000
Organization: Usenet Network
Message-ID: <179650824815.3148.6653715043111591603@kernel.org>
References: <20261204-net-next-mptcp-misc-feat-7-5-v1-2-1449de51adae@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3129508"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yxEtQs7twT25XBwHebEMmTjNFB0= sha256:i0/o/9X0ISNvfLcz1Bf+8ppQUOGYoC3d6hnFuxIZ3iM=
	sha1:ndX9tCFxAyBA5VzWJOw9Y2cl6Yc= sha256:dOpE0sgVDv+4uTtC/GaVtzte/6NzOq7NL/syPq+WcPM=
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 83152117ED7; Sun,  6 Dec 2026 01:04:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.539
X-Spam-Status: No, score=-3.539 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.14, 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 f2Vfmry3_nuM;
	Sun,  6 Dec 2026 01:04:22 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-378153-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 1E1F2117EC6; Sun,  6 Dec 2026 01:04:13 +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 F16BE2F004; Sat,  5 Dec 2026 22:04:10 +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=1796508250;
	b=BBCsMNEgTMahoGU7qWSkw80jky6ip3aobqEU+jOrZqCd6xWIqsG/0hI6YXyPoFVd5o0b
	 /hljXHjkQWUwOWHgVHTLE8NoXkNJE24bhZbzJsCKpalvFJb0de08FNJJ75pwI/ewmYgD3
	 v7JoHUy1fxjXVXg4ZSBG7YC3MMC0eyzMUJ117FfTtdUfBJei8bh+toCCBLAz8te6dY0ny
	 ckFcdIkxfPgyOGVT2UtttHqsYrH0UFw6vATkqjKod+r0tRKPOtCCRrekhW4c2auRm9hZm
	 go8svBRO3FpD6LBOt92On8jT8/M9aPwKyg9sKH97+SoHVl+7drYNpcYOFtGsF86df3A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796508250;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=OFmzy64/jRh59Or4mJ7+Ihx8Tzyt34SEFDjEiaW8l/Y=;
	b=jk7gIXK3YYUyeL700cQ1LGTMEDynUL8VzYaNmUkxXzyTSklIn3lCERBGPoivmsonBCPE
	 PBBlCW7ynWUgoRJrNwvLAp43bzgJL7GbY3MQHoxF++r5wNmZ4aL/Me1qmQ0iyL6mgokGW
	 R230CxpCwTdB57IuxsfuthppA4rIQT/DvOnFkKdSoIBfAlbfC6dIpkIWGHlLhkiyVetHH
	 JrLCZxmMAznGrPax4KdtYMGI6hgcGI9jtslfFlYmQzs7/HXmdLmW3a4tg7uQAxo/JoKwV
	 sJfeMwyVZZi4NYg1yrtbYF/u7kPqn4qbX5M1KqQNCxUWxMO2QEmtAoFyEg6/vhBV4AQ==
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=Aivg1cyY;
	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 B1651606A336;
	Sat,  5 Dec 2026 22:04:10 +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=Aivg1cyY
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=1796508249;
	b=XiWi0RjCEfHi6QiHPpd0NcQF2k7bqzzscrMMnvBwlIe1ccU/E5e79ePIWDVcGRq9oAqY
	 ZsTZ/uxxy15a2vvUtzB0PuA/NYm5iM0JacbEZCARX951pbg0VmuwNpkvDihPC2n/fKUBQ
	 PVctZjtbifkK9C6ftPpEHYIfARgUWu41J+quDAZNhSJgMon0TeATpasG954eoNSREphd1
	 V3GZCrIHLczONZEknH8wjM8Fv412+yPEsgEiiUAj7xcq/dlwtGCq/K5Pvro4e8RvxnKvM
	 AE2e7BcRKEWSIwqR2PGrpEBbWnmb9qElvD72f1VIb6TyU31f14Ub7K+r6bU+5aQmuoA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796508249;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=OFmzy64/jRh59Or4mJ7+Ihx8Tzyt34SEFDjEiaW8l/Y=;
	b=RYxlrEhxF+4fZlDEzKViOO6zGSjDmmCsBd7agRMac9XAa4Q/J60E1+vTpSIpIn07i7Yq
	 K5zSJeFlNB3QaaxoHlXI3YS3HipPXQL00osn/T6DMh8EMghf981iIGBZXF/af9k9QmWPt
	 8Eb5rzw5bIf6eKvMiJ/FlYg8zJVfkgQBJc4YrVimw3My9Qw8B+bCMNRJ/AEqfJ5HojKHP
	 HdmJQWFLzy8NXcPD8RBvhexHxxdkawQ6E5ySr3TubY2T8kZ5jsYir9oS/boO6j8zdHVas
	 LAeO7GItEE1jkUcSNLICzyEn9/rAkyojg5ej5/qSHI5CCCUtyojl9xydDcn5wi3jQUw==
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=Aivg1cyY;
	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 D13CE606A31F;
	Sat,  5 Dec 2026 22:04:09 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9D8A51F00936;
	Sat,  5 Dec 2026 22:04:08 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796508249;
	bh=OFmzy64/jRh59Or4mJ7+Ihx8Tzyt34SEFDjEiaW8l/Y=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Aivg1cyYOm2mghr8ZMMBehkcvPCgiLOp8Ll+vjaTWDwQzE4e2iVBw74gd5TmPe5g+
	 vB3BAeWk8XNHshtsWsZ7+kWK8IfA3+NZGWoIXCqc/Q+eHhICFovBP9FzfyFRFIvc0/
	 zzSnt5qsg6F/2nM/ynfOdrv07i+FB0zPtNu7FxEirRT0iOyOTz9dJ9+Ld+Cz0K96nQ
	 YkrxsVTteVhcL07PBqHYvOY0Lg4DeVFsoBfDPLv5Peb2yF4T+mfXNaIPYzWV3Jtk6P
	 RZGv+Xx88EvEaULk5R/aybdw+SvpFK++oY96ATYgaOyl/9m2lOL7beXiAjLg2D/CBx
	 S+tX799OdCDZg==
X-Cc: martineau@kernel.org, geliang@kernel.org, davem@davemloft.net,
 edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, willemb@google.com,
 horms@kernel.org, liyonglong@chinatelecom.cn, shuah@kernel.org, fw@strlen.de,
 netdev@vger.kernel.org, mptcp@lists.linux.dev,
 linux-kselftest@vger.kernel.org
X-In-Reply-To: <20261204-net-next-mptcp-misc-feat-7-5-v1-2-1449de51adae@kernel.org>
X-sashiko-severity: Medium
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