🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25972

[PATCH net 3/9] mptcp: limit an orphan probing a zero window

#25972
From: "Matthieu Baerts (NGI0)"
Date: Wed, 02 Dec 2026 21:29
82 lines
11452 bytes
Since the previous commit, an orphan with data to send is kept while
the peer acks something, at least the window probes: a peer keeping its
window closed, e.g. not reading, could then keep the orphan forever.

TCP limits this for its orphans: tcp_probe_timer() aborts them instead
of probing again after the max interval. The subflows of an MPTCP orphan
are not orphaned: they probe again then, and back off once more, up to
tcp_retries2. So check if TCP would have aborted them, when the close
timeout expires. Same with data in flight, when the peer has shrunk its
window to zero: tcp_retransmit_timer() only aborts orphans then.

Two corner cases needing non-default settings are not covered, which is
fine: an idle subflow refreshed by keepalives still keeps the orphan
when the stale detection is disabled, and tcp_orphan_retries is ignored.

This was found by an AI code review agent, while reviewing the previous
commit. With its reproducer and a long pause, the orphan was kept until
the end of the pause. It is now reset as TCP does, respecting
tcp_retries2.

Note for the backports: this patch is needed with the previous one, and
before v6.15, tcp_rto_max() can be replaced by TCP_RTO_MAX.

Fixes: e16163b6e2b7 ("mptcp: refactor shutdown and close")
Cc: stable@vger.kernel.org
Reviewed-by: Mat Martineau <martineau@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 82a0cbe38192..96b3baef341f 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -2814,6 +2814,32 @@ static bool mptcp_close_tout_expired(const struct sock *sk)
 		  inet_csk(sk)->icsk_mtup.probe_timestamp + mptcp_close_timeout(sk));
 }
 
+/* Would TCP abort this subflow if it were an orphan probing a zero window? */
+static bool mptcp_subflow_probe_timed_out(struct sock *ssk)
+{
+	u8 retries2 = READ_ONCE(sock_net(ssk)->ipv4.sysctl_tcp_retries2);
+	struct inet_connection_sock *icsk = inet_csk(ssk);
+	const struct tcp_sock *tp = tcp_sk(ssk);
+	unsigned long limit;
+	bool slow, ret;
+	u64 when;
+
+	slow = lock_sock_fast_nested(ssk);
+	limit = tcp_rto_max(ssk);
+	if (tp->packets_out) {
+		ret = !tp->snd_wnd && icsk->icsk_rto >= limit;
+	} else {
+		if (icsk->icsk_backoff < retries2)
+			limit *= 2;
+		/* a shift of 32 already exceeds the limit */
+		when = (u64)icsk->icsk_rto << min_t(u8, icsk->icsk_backoff, 32);
+		ret = tcp_send_head(ssk) && when >= limit;
+	}
+	unlock_sock_fast(ssk, slow);
+
+	return ret;
+}
+
 /* Before its DATA_FIN, keep an orphan while a subflow can send its data */
 static bool mptcp_orphan_keep(struct sock *sk)
 {
@@ -2829,7 +2855,8 @@ static bool mptcp_orphan_keep(struct sock *sk)
 		/* a live peer acks at least the probes, every TCP_RTO_MAX */
 		if (__mptcp_subflow_active(subflow) &&
 		    tcp_jiffies32 - READ_ONCE(tcp_sk(ssk)->rcv_tstamp) <
-		    2 * TCP_RTO_MAX)
+		    2 * TCP_RTO_MAX &&
+		    !mptcp_subflow_probe_timed_out(ssk))
 			return true;
 	}
 

-- 
2.55.0
Technical Details
Message-ID: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-3-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-376063-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-376063-linux-kernel-netdev=dewy.ru
From: matttbe@kernel.org ("Matthieu Baerts (NGI0)")
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 3/9] mptcp: limit an orphan probing a zero window
Date: Wed, 02 Dec 2026 22:29:33 +0100
Organization: Usenet Network
Message-ID: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-3-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="2065776"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:3S5ojPPGmvew1dDnt3EbdG54Dwk= sha256:8SmpNPGMpSaOu5HFyg07nwyueqp6Amf1jadfBHAqZiE=
	sha1:n6N5y/pszHwOKGp+JIyM/NJ3evk= sha256:xeX+FWVu3HZ8JfxNmRP0MxnusZ78jHRjhtHpyZqK9Vc=
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 42682117737; Thu,  3 Dec 2026 00:32:19 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 Ub7bFnKu72RL;
	Thu,  3 Dec 2026 00:32:16 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376063-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 293F1117736; Thu,  3 Dec 2026 00:32:08 +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 E86172AAE8; Wed,  2 Dec 2026 21:32:00 +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=1796247120;
	b=zkfJbAi3NwiWxMH1b/7VP85WF0yvafJ57H0B0Sxw+YVXHqdu2Wfy0HUNjXaQzKawX9+M
	 FyMKCc9zFvuVkVU5U5a/K0fDmDp05Nw2Qfsnqt1mcK7Exl+KXHNKGWZvYlspnIvPbauLE
	 mbtxb7kaO6FjwPOymNoIIBh/9bdbI/w1yMLxMj9JYvAkyBEctAYFdzVs8yWWdUjMh1s8X
	 zM9BUxdiO2CG44yJR6eJU3fe/tTnjr5O6Mf+b6AtZemJyCESWuQNeRwZolD3G6yu9M8v8
	 P968eSLr10sPkejanoc0kQCyEth8tDBFFQj/TehhgwMBAhtP0QFfDsMzHozuWJZxNsQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796247120;
	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=IEjJKECN2/7VeWdgOV91/jwibzYFS9CqhpDOpHSZyCQ=;
	b=vgvFVE/1JSv7G4FCtRDlC+GJLrFLjpoqCv00HU4vD65TUwcTSQKSeNE9uKZnHUmlYZrS
	 5Iy65UR6hWrBsY0bMN0W2H19Jwx3EcVNOF6iW9YDsuZlExqi/4Oeqddf3pmkebrwCIyvA
	 VVV54dLhpi0Q3SIx2VybcXyZ/TF/T60FINuqOG6ITk8riDisoLcWDwIr7i/tRQTzRrCPX
	 zFf4tyGgGCznJXOM0WQJdyT9VK94eEO7qNTVHdQxWlZXIbp+1OXeO66qmRdEvhgoc2Sam
	 IU55RMKGiNRaAgINVA5q0ZJO6IDQdMyasdGj1THz8FsdSm0HkFunOuYIaKcIbd8xEvw==
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=T56j4FjI;
	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 BFC23606A33A;
	Wed,  2 Dec 2026 21:32:00 +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=T56j4FjI
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=1796247119;
	b=shE8FT+qv/2DWQDD/4GGOvhOL7HDrX2bu9xEK00KrqrFlyrCOcz4OFofK/RJkQFvpdpO
	 j/kNohYv3+C9e3u1wiTNUudXaCf4/G9sYsWT0m5hjMZK2V+dVRYmo+U9f41qpMH1aTa4C
	 N86xTR+kwiGiRQPXZH27LapGr83ZwLr5dnghlIaWsjtxj+YUnkK06d14E5XUL+5x1IjYP
	 YGJOFajyaWZOJImXJXGJg1xIizH2efxXmQCy/lx0LpuCvxrKPMkMrZroYtNKV6763T6NK
	 xHlKyA3GOv/ZtcmcpMgW6V8qZTh0fS7L75nBL+XYaCa2/DzKF31aksKmyyTDKtUTHHQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796247119;
	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=IEjJKECN2/7VeWdgOV91/jwibzYFS9CqhpDOpHSZyCQ=;
	b=FsUhPv4UsJG81Fw0oLs0mRh40YduOeUcslg/dZ9zCcoQPKmfRO2/eEPy+UKG0plp+L3p
	 C+sfV4f/oYKwp1MsKnDB5Le0U3WdIidCkA9UbK+jd/13zaF1t9JioXY4oFOeWe5MBEDFq
	 MSl0csLN110CGORu+LVHFC/Zy7Rs3LOWtZyzgtIX02MhP/njJ6Q6inZXXLbJo5gFWpTNc
	 JTk7bqOjH2bB+yleaScsoGCjYC/bHqYVet6kY8GGMGka/eiG6xFF6+F+bRtQjh8wnzTra
	 wQ5REFdoQjDubR7FXh5h/9sTaCvW7Jy88psEYz6vVQuv16x6HiUpoYyjBNmor08gawg==
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=T56j4FjI;
	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 DC37B606A322;
	Wed,  2 Dec 2026 21:31:59 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E9BD1F00919;
	Wed,  2 Dec 2026 21:31:57 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796247119;
	bh=IEjJKECN2/7VeWdgOV91/jwibzYFS9CqhpDOpHSZyCQ=;
	h=From:Date:Subject:References:In-Reply-To:To:Cc;
	b=T56j4FjI/PZavSfcZCLTYWta7HbpE7Ryzlw6ldC7yBk5Oo2WUGW5hJsj4ouJ12F9M
	 V1/MsoXHdBDK2cPv8M1SEKqq8e4j6lrbXsFKMJeQd/bzdSQqwEPZ9725Chr7BNZI7t
	 TpHFoJWpIwI7NvsgbBV2HNQRkjZnKQsBvEciAZEMK5f7OqmYtJ08T3MsGW0/9lUqaJ
	 rRbC6R6zfoWqa8TbxfXbyX6AE/m9kovjZC0hSOdm16sd+S1A+FpAyfJ2zS233Fby+X
	 uPIpQ+osoLKflgDesIU/iv1tzcPbjb9T1d2cRu/hCh0Bu2hDKqoyU+gqujXKvhdpXo
	 CVcKP1Siw9qYw==
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
X-Mailer: b4 0.16.0
X-Developer-Signature: v=1; a=openpgp-sha256; l=3182; i=matttbe@kernel.org;
 h=from:subject:message-id; bh=ZyvWg8y4eva3hDTqr9Z7YtHolbpGvpy2Vy90OQqPCjQ=;
 b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLIF+uwO9XY3XPe/dutbRb0IQyCzycd5ddfX1n102FXiN
 vu9T1xbRykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwER6RRkZevXn1QR7PDvKuM1n
 jbxp8y3/f2Xud85PVY9d1/54jV1sKCPDLp3tzgVJl/TdGbTeLfq4SNxMyy6+J+qgjtGBWv2mo10
 sAA==
X-Developer-Key: i=matttbe@kernel.org; a=openpgp;
 fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073