🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26590

Re: [PATCH net 6/9] mptcp: wake up blocked senders when no sf left

#26590
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 21:51
100 lines
11872 bytes
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

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

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).

- [High] A blocked send() can still hang forever after the last subflow
  is gone, so the bug in this patch's title ("wake up blocked senders…

--

mptcp: wake up blocked senders when no sf left

This commit sets SEND_SHUTDOWN on the msk when it moves to TCP_CLOSE
because its last subflow is gone. This is done at the bottom of
__mptcp_close_ssk() and in the close-timeout branch of mptcp_worker(). A
send() blocked waiting for memory then returns EPIPE instead of hanging.

Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/648

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 1f045348764ad..e89ed0b1e4218 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -2756,6 +2756,8 @@ static void __mptcp_close_ssk(struct sock *sk, struct sock *ssk,
>  		} else if (sk->sk_state != TCP_ESTABLISHED ||
>  			   msk->in_accept_queue) {
>  			mptcp_set_state(sk, TCP_CLOSE);
> +			WRITE_ONCE(sk->sk_shutdown,
> +				   sk->sk_shutdown | SEND_SHUTDOWN);
>  			mptcp_close_wake_up(sk);
>  		} else {
>  			mptcp_start_tout_timer(sk);

[Severity: High]
Can a blocked send() still hang forever if the only remaining subflow is
msk->first and the path manager closes it gracefully?

Both new SEND_SHUTDOWN writes depend on the "all subflows closed" check at
the bottom of __mptcp_close_ssk(). That check requires msk->first to
already be in TCP_CLOSE:

    if (list_is_singular(&msk->conn_list) && msk->first &&
        inet_sk_state_load(msk->first) == TCP_CLOSE) {

A peer that sends RM_ADDR for remote id 0 reaches this path. So does a
userspace PM subflow destroy through mptcp_pm_nl_subflow_destroy_doit():

mptcp_pm_rm_addr_or_subflow()
  mptcp_subflow_shutdown(sk, ssk, how)
  mptcp_close_ssk()
    subflow->close_event_done = true;
    __mptcp_close_ssk(sk, ssk, subflow, MPTCP_CF_PUSH)
      __mptcp_subflow_disconnect()
        tcp_shutdown(ssk, SEND_SHUTDOWN);

mptcp_pm_rm_addr_or_subflow() only skips subflows in FIN_WAIT1,
FIN_WAIT2, CLOSING or CLOSE. It has no check for the last subflow.

free_first is only set at destroy time, so dispose_it is false for
msk->first. __mptcp_subflow_disconnect() therefore only sends a FIN, and
the ssk ends up in FIN_WAIT1, not TCP_CLOSE.

The check above is then false, so none of its three branches runs. The
msk does not move to TCP_CLOSE, SEND_SHUTDOWN is not set, and
mptcp_start_tout_timer() is not called.

Later the ssk reaches TCP_CLOSE. subflow_sched_work_if_closed() sets
MPTCP_WORK_CLOSE_SUBFLOW, and __mptcp_close_subflow() calls
mptcp_close_ssk() again. That call returns early:

    if (subflow->close_event_done || READ_ONCE(subflow->local_id) < 0)
        return;

So the "all subflows closed" check is never run again for this subflow.

The msk then stays in TCP_ESTABLISHED with no usable subflow:

  - probe_timestamp is never set, so mptcp_close_tout_expired() stays
    false and the new SEND_SHUTDOWN in mptcp_worker() is never reached.
  - __mptcp_subflow_error_report() only passes errors on in SYN_SENT or
    after fallback, so sk_err is never set.

A sender waiting in sk_stream_wait_memory() would never see sk_err,
SEND_SHUTDOWN or freed write memory.

Should this path re-check "all subflows closed" when a FIN-shut first
subflow later reaches TCP_CLOSE, even with close_event_done set? Or
should it arm the close timeout here?

[ ... ]

-- 
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: <179633471458.3146.5840974819566449849@kernel.org>
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.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-376887-linux-kernel-netdev=dewy.ru
References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-6-9f03efcb1a17@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mo.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-376887-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 6/9] mptcp: wake up blocked senders when no sf left
Date: Thu, 03 Dec 2026 21:51:54 +0000
Organization: Usenet Network
Message-ID: <179633471458.3146.5840974819566449849@kernel.org>
References: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-6-9f03efcb1a17@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2606209"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gaA+e/o+mCkTP07a19W1GiGjPUw= sha256:DIq8sRcY/8Ao1C7B68WHBE69KmZpaoUJdmVLiczm4go=
	sha1:gGjl9DBlckAOsOfkgyS/kdYyEJY= sha256:AmdoKdtgfntuQx/qbt7WdMfkCPG8zC7pRU6ErepHnbk=
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 29641117A44; Fri,  4 Dec 2026 00:52:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.74
X-Spam-Status: No, score=-3.74 tagged_above=-9999 required=6.31
	tests=[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 VXQ_soM5w7H7;
	Fri,  4 Dec 2026 00:52:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-376887-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id C00C2117A08; Fri,  4 Dec 2026 00:52:08 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id CA1DB2438F; Thu,  3 Dec 2026 21:52:03 +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=1796334718;
	b=0eSIsyla6tMcNgjU9RGz0dnvHf5ZKvUu8fgXeB0GhnAycEq4JQ5UyU3v6otqsnf+PtxE
	 reXUTITFRJDDeu2XWABOfEd34hmNCzi5mNn9JDFoC6Zi9bRNqvi5ZRUmcp+0EKP3mCBLw
	 3KjTAdWU2wGeSeCBD6Shs6ZuQxLTF1mKwFEFB0otD6q1l5r4yy8Ad3cZgcU8IBU2cCkEq
	 k5WsZ+OAmUhq5HVG61TV7exIZlemx3IF0JALRsOX5Hp0jhybw4hQzFNXduUREwFSk+T9j
	 6th0Wyw2hRqaa8aiMN8d3aB1pIfgapy/0yO6lVrOiXMf3Qjw3PK36+ChzSZCIMx4DGA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796334718;
	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=oR2A0cA2yOC+fDasOYZI3+ufh+ZP0WUlhr+3alZriQM=;
	b=H3iUyyK8qZnyUJLStEAbzPvnp6Hyknb1+ekQq2xuPAd7Wzm8aYuYb2ZVg3MVK8bYHthx
	 Xgo0xaOp2/Rv9xRrCWp3PCfQ2nL9lyfRLMHi98goaIt3XsXPoayVVKGuA0Y1IpOeLxfVH
	 bLNO/XnJtRUj4uZdRk+Dqi+tXQbUY0hpNstFwJuy/+bpotYMSk4AH7P/vo7zX70qWtYpq
	 uFRjPNoqMa0EmhPD5jLfk1S0bT+gK9w7bCiTj8lZdZhuEA2NwgE0b5r0ANFmlQ77zGg4B
	 pZLCVLjg0pr4IUBbtbutZdk8cPRUxjL3vy3rqxOWb/OLR5c1vGFJsm12WcJkBUTPPXg==
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=SKhSSyQv;
	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 3E44A606A69C;
	Thu,  3 Dec 2026 21:51:58 +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=SKhSSyQv
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=1796334716;
	b=KUR8TNv1NxRxvqzIuNIk+VW19KkEYczHeVEzHcJOLGuW46dVaxj61SyMVZX9m0tA6lJ/
	 F3AGDqEH5xGZ+z0XqOHorTT6wRT7m1IbcvyXfLarjlriO7v6y7w39Pb8nsvSFeuwWhvDg
	 R0FJhCcsw7KEY2+RFqYzpL4i82rSOkryKe8Ky/lH8obaJ3uZQRkTMSKKijBLe/28qrz+k
	 hNMxRDNpe65u8wC6U/xH6DFFRCH9OmfCFA/aaYEEkYM6zfzWrmjOCeUTO9aGTsIqFaMjh
	 oxFLMJfC/rJdrmVcw8Mq/x3HVUijC9gpTt53Qh4YnUgwQNgjSyuwGq2g9vs4yDrkTjg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796334716;
	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=oR2A0cA2yOC+fDasOYZI3+ufh+ZP0WUlhr+3alZriQM=;
	b=TtGMsvfaE4/DrxvhMGTmdKULRSb3tLAnrSpGrBqrMIMI0Euc7WL5NMHjcHvIl70GRrkI
	 gtzkXG/gGIf5eGIgy+42+z7eg77P4KdZjAlBVofao4x4uHVDZqhfCXPmPCNiF4ddKGiKO
	 LSKhYQi0CvHayozYYe3zZ0tJwjU7XbgAFYGm0unZnFLlLyeyHNk7VyudJnFngEUkAV/rZ
	 0YpUR46KPdgqVVgMnZYaVjRPjTW5PRXBjpKEms6klkU8FHC2ISg+FHbtNoJP4LOLC8/MU
	 TxLfZuw+lNTtizYE6PyJlwGrzRnS8kSGhqjbXoj3w33XSVl9hFeuQCAk5NSH8LCrNLQ==
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=SKhSSyQv;
	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 2BAD0606A6B1;
	Thu,  3 Dec 2026 21:51:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C4071F00933;
	Thu,  3 Dec 2026 21:51:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796334715;
	bh=oR2A0cA2yOC+fDasOYZI3+ufh+ZP0WUlhr+3alZriQM=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=SKhSSyQv7T/r0YSHLDA5NxyJMRELkR8lklR/HXgfEVvV8bpQOaALqZJbJQtkIkDjX
	 OIgXsK4C8YNw4BDd/JwIFoXVtOdHq5/ajDdMaQdO3BA/uECx+K8h7oR8ndRuq/Gi1+
	 jZxpSdPudlBZwZcemEVdRTwmdH5taCWLMTKIY9s/vo+XX5udqZ3j12HOUr3RhBFsk+
	 OBN/SS0R/FkwQF09OGsFgBVzgC4tV8F6eaRaiXEQzXgw9nKZWs3p5LdhB8rYlWsfH6
	 RmdYVdVAAfaqxpPiInUwAFXOY8apcQY9L204Km1sCge8i4+wv/sCpXS8wsIms6erQk
	 P3/EoW9ST9llQ==
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-6-9f03efcb1a17@kernel.org>
X-sashiko-severity: High
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