Article View: linux.kernel.netdev
Article #26588Re: [PATCH net 4/9] mptcp: count orphans as TCP does
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 21:51
Date: Thu, 03 Dec 2026 21:51
146 lines
13299 bytes
13299 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] For fallback MPTCP connections, the new OOM abort at close()
does not reset the connection.
- [Low] The MIB counter and the RST reason disagree for the new MPTCP OOM
abort.
--
mptcp: count orphans as TCP does
This commit adds MPTCP sockets orphaned by close() to tcp_orphan_count.
That way tcp_max_orphans and the TCP memory limits apply to them. If
tcp_check_oom() reports too many orphans or too much memory, the orphan
is reset at close() or when its close timeout expires, and the abort is
counted in TCPAbortOnMemory.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 96b3baef341f3..fc8aad7e2fde9 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2840,6 +2840,16 @@ static bool mptcp_subflow_probe_timed_out(struct sock *ssk)
> return ret;
> }
>
> +/* As TCP orphans: limited in number and memory */
> +static bool mptcp_orphan_oom(struct sock *sk)
> +{
> + if (!tcp_check_oom(sk, 0))
> + return false;
> +
> + NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY);
> + return true;
> +}
[Severity: Low]
Should the reset sent for this abort use SK_RST_REASON_TCP_ABORT_ON_MEMORY?
Both new abort paths end up in mptcp_do_fastclose(). One is a direct call
from __mptcp_close(). The other is from mptcp_worker() once
mptcp_orphan_keep() returns false. mptcp_do_fastclose() hard-codes the
close reason:
net/mptcp/protocol.c:mptcp_do_fastclose() {
...
tcp_send_active_reset(ssk, SK_RST_REASON_TCP_ABORT_ON_CLOSE);
...
}
include/net/rstreason.h pairs SK_RST_REASON_TCP_ABORT_ON_MEMORY with
LINUX_MIB_TCPABORTONMEMORY, and __tcp_close() uses the two together:
if (tcp_check_oom(sk, 0)) {
tcp_set_state(sk, TCP_CLOSE);
tcp_send_active_reset(sk, SK_RST_REASON_TCP_ABORT_ON_MEMORY);
__NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPABORTONMEMORY);
With this patch, a non-fallback MPTCP OOM abort is counted in
TCPAbortOnMemory, but the tcp_send_reset tracepoint reports
ABORT_ON_CLOSE for it.
The hard-coded reason was already there, but this patch is the first to
use it for memory aborts.
[ ... ]
> @@ -3579,8 +3592,15 @@ bool __mptcp_close(struct sock *sk, long timeout)
> /* all the subflows are closed, only timeout can change the msk
> * state, let's not keep resources busy for no reasons
> */
> - if (subflows_alive == 0)
> + if (subflows_alive == 0) {
> mptcp_set_state(sk, TCP_CLOSE);
> + } else if (sk->sk_state != TCP_CLOSE) {
> + /* as TCP orphans: counted, and limited */
> + tcp_orphan_count_inc();
> + set_bit(MPTCP_ORPHAN_COUNTED, &msk->flags);
> + if (mptcp_orphan_oom(sk))
> + mptcp_do_fastclose(sk);
> + }
[Severity: Medium]
Does this branch reset the connection when the msk has fallen back to
TCP?
On fallback sockets, mptcp_do_fastclose() sets TCP_CLOSE and returns
before it sends any RST:
/* Explicitly send the fastclose reset as need */
if (__mptcp_check_fallback(msk))
return;
So subflow->send_fastclose stays 0. Since the msk is now TCP_CLOSE, the
destroy path runs right away:
__mptcp_close()
__mptcp_destroy_sock()
mptcp_destroy() /* sets free_first */
mptcp_destroy_common()
__mptcp_clear_xmit(sk) /* drops unsent msk-level data */
__mptcp_close_ssk(sk, ssk, subflow, 0)
__tcp_close(ssk, 0) /* dispose_it is true */
If close() ran with data still pending at the msk level,
mptcp_check_send_data_fin() returned early. The subflow is therefore
still ESTABLISHED, and __tcp_close() sends a normal FIN on it. A RST
follows only if TCP's own tcp_check_oom(ssk, 0) in __tcp_close() also
fires.
In the orphan-limit case, both checks read the same cached orphan count.
TCP then resets as well, and TCPAbortOnMemory is incremented a second
time for the same connection.
In the memory case, tcp_out_of_memory() checks the subflow's
sk_wmem_queued against SOCK_MIN_SNDBUF. That value can be small while the
msk's queue is large, for example when msk-to-subflow pushes fail under
tcp_mem[2] pressure. Can the peer then get a clean FIN after
__mptcp_clear_xmit() has silently dropped the rest of the stream?
The close timeout path in mptcp_worker() handles the same fallback socket
differently. There, free_first is still 0, so __mptcp_close_ssk() goes
through __mptcp_subflow_disconnect() and tcp_disconnect(), which sends a
RST.
The commit message says:
reset an orphan when there are too many orphans, or when TCP uses
too much memory: at close(), and when its close timeout expires
Should the fallback case get an explicit reset here, with
TCPAbortOnMemory counted only once? Later patches in this series don't
seem to change mptcp_do_fastclose(), mptcp_orphan_oom() or this branch of
__mptcp_close().
--
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17%40kernel.org
Technical Details
Message-ID:
<179633471192.3146.8810228234232955911@kernel.org>Path:
mbox-mo1.pugleaf.net!news-fra.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-376885-linux-kernel-netdev=dewy.ruReferences:
<20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-fra.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-376885-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 4/9] mptcp: count orphans as TCP does Date: Thu, 03 Dec 2026 21:51:51 +0000 Organization: Usenet Network Message-ID: <179633471192.3146.8810228234232955911@kernel.org> References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2606100"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:E6F0ucH4go/fUgLFZIluLwhEgCs= sha256:gPFzQJQ4eQ6yKRqWndnwcEFFxjECgXOKFxXc6C3lZlc= sha1:8/IMHCl4i7r9R3ZE15klhFKvqmY= sha256:dGRJeW2EA3n+BGUGiyGVJkI3ZzufkkX06llMYLfWTUg= 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 5968A117A44; Fri, 4 Dec 2026 00:52:17 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.64 X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, 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 rfkXqFBgwxpj; Fri, 4 Dec 2026 00:52:14 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-376885-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 sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 0D635117A42; Fri, 4 Dec 2026 00:52:03 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 744D022314; Thu, 3 Dec 2026 21:51:59 +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=1796334714; b=uhgFYdMsm/QEMTscXFjnmUTbd5WYQkv77CA3uDDXehJZL8OJLJnwsBqLxdUpvPBM9dR7 o7eMgAkSFcU7gzzMUHxWKPrTudVqPiRoGVgKgrDVFpkfGleya/p9AkVHDQ7j/pEOsHCHw q4djBL3Atpp+zHGkxzcWySGCYbpsRXBJSd3J8R3oHub5k2B4cyaIoOpoaEaR4FxL6Trr4 eclHRFLKNb/UDr1NAzQ9s87IDYPDrPFILZP9cvQzuIY6p4OdgAZxOymzCVTwnjv8OzSu2 B63Af3IZZF9sPuD45f543NPZ3Rf0+kQ9Ur5LlTfQGDkB+AlZQjrJWifuGGF9MNOiWBQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334714; 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=B2ynsbDLc0ctCKqac6w4btSpcFUbh0gFdloh9+eFNWg=; b=HIbgNVanF+rIgjM35VKke5tN3ePeI9zbeJCowtSYBEej1HaXii8ExQUQf+yDvlaDXy4G KD/vHsMqOj8nDRLlJm/mgZwP3XKUAU18P4/80kdKmq2vlVqsZfurwwlmuz4HvL0xxD+f0 tOnh/csJtDHTd2gEm2Kinwi2Qy+AMD15QLchaChtI3OGWuIbQohxhROYEDt07lx4/QdMX FkGOOWrEMIvqSNhTva3QfR9Mt52Fzka+h1F7EciIkdC0eqplQXKm2Jw9uDO0m3vCr57bp LvX+Rfa94luGRkX5efWaAjkHbJKgOQbx0Wcu9127I6iNOWEkc/Q6RJ4Zs5KOiHbnP7A== 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=QtY4eq+K; 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 3D41B606A692; Thu, 3 Dec 2026 21:51: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=QtY4eq+K 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=1796334713; b=dyKscCT+MXnU4jwwP3e+rdZQDZKQYNiG0i0hFf3Xu57nR3IWjk1xu1tUH4nzcgqGz/pz TyHU6B4JOmj6e+y9j+menKhtbBNDrCQBJ+uUh3WslgX1J2LzxFO1nhpzWy01JG9P6PlU9 71FPuTORqdLTaXkTmt3xm5MxST6AiOZgz8+nSkAOF/e5hXhlDNgkS/ybzKwoo5yoc7SXI ugP9QIwLgXuNl39xHaZ3544VrT6ZuIEsFC1BoudOtK9nxhpJQGqiBJNpuLzOLZGPHNTwW qppXYrnAi3Is+jXWyrYxGCqwes9KKvIdOsdxB7ZaoAjwMtreZ+n5ROt3RhPf4fKPzbg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796334713; 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=B2ynsbDLc0ctCKqac6w4btSpcFUbh0gFdloh9+eFNWg=; b=xcSVU31IO1j+yVbJS7m5VBXCR2l6hjeAAfTEMXgUg5Ykn/hkORX0lBLWnx6eFhkTKhKQ Ry5TXXzw0wN2c7x1zeXnEi37jCARH7OORIAwZ2G3kgRS3WN5BZxsJLZ5n6T9w2sXHBbI4 yNgAIemRnG+zJkEwEvGJpKCoikKEhvNFhcRrn4kc191fCySHmWs7YXft+eJ9oRX4B375V LsJladZEUPjOuSZy3r9JY5V//K5Apdz/CLi9brkn/lONOnmRBv6/5tnYR4TtC2OF/Itq+ fmREViWl5U44LCVz56i2P5IWz+A2JoMS+h57htg/xk42xUyW5ped49ePUmuQFsSoBzA== 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=QtY4eq+K; 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 5D629606A687; Thu, 3 Dec 2026 21:51:53 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54F071F00933; Thu, 3 Dec 2026 21:51:52 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796334713; bh=B2ynsbDLc0ctCKqac6w4btSpcFUbh0gFdloh9+eFNWg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=QtY4eq+KjfZl4zJCc4gjlsyrAJKUBl6FDUf3u5C5CGTgaPx+OiAOcRuw6/hsizyhc KDCb0JwBZHHkIkGR46XKtomwH0Seh/5M5ANbk4yoab4EB5csorCELykvi/1lkiqBcm Oav5yezGLmYZ7kSQPr6qonEdMrXERmzIOpgTrJzRokrc6I5N9zo/oSTE9tfbeIDUf5 LZXYerm4qR+ToeXZVYNGBT9RNlAt1QHjo0eS7U4JzgnasJILN4c2VUU6beFRM4i/Dw 1pWl4KoWEhQB0bQEjuw80nSXHYlPCpeagCSpC+JS04zEIOrdCXGrwIi5sTQTuekdY8 PxTyYpTiqf8ng== 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, dcaratti@redhat.com, netdev@vger.kernel.org, mptcp@lists.linux.dev, mason@kernel.org, stable@vger.kernel.org X-In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@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