Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: matttbe@kernel.org
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
Subject: Re: [PATCH net 6/9] mptcp: wake up blocked senders when no sf left
Date: Thu, 03 Dec 2026 21:51:54 +0000	[thread overview]
Message-ID: <179633471458.3146.5840974819566449849@kernel.org> (raw)
In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-6-9f03efcb1a17@kernel.org>

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

  reply	other threads:[~2026-12-03 21:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 21:29 [PATCH net 0/9] mptcp: misc fixes for v7.4-rc7 Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 1/9] mptcp: pm: kernel: c-flag: keep local_addr_used in sync Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 2/9] mptcp: keep an orphan while it can send its data Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 3/9] mptcp: limit an orphan probing a zero window Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 4/9] mptcp: count orphans as TCP does Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 5/9] mptcp: return EOF after a DATA_FIN, " Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 6/9] mptcp: wake up blocked senders when no sf left Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko [this message]
2026-12-02 21:29 ` [PATCH net 7/9] mptcp: reclaim forward memory after coalescing skbs Matthieu Baerts (NGI0)
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-02 21:29 ` [PATCH net 8/9] mptcp: don't charge a shared page twice at accept() Matthieu Baerts (NGI0)
2026-12-02 21:29 ` [PATCH net 9/9] mptcp: don't charge the backlog " Matthieu Baerts (NGI0)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179633471458.3146.5840974819566449849@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dcaratti@redhat.com \
    --cc=edumazet@kernel.org \
    --cc=geliang@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=martineau@kernel.org \
    --cc=mason@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox