All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matthieu Baerts (NGI0)" <matttbe@kernel.org>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH net 4/9] mptcp: count orphans as TCP does
Date: Thu, 03 Dec 2026 21:32:24 +0000	[thread overview]
Message-ID: <sashiko-outbox-248693@kernel.org> (raw)
In-Reply-To: <20261202-net-mptcp-misc-fixes-7-4-rc7-v1-4-9f03efcb1a17@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: mptcp_do_fastclose() skips subflow reset on OOM in
  __mptcp_close() on fallback
--

commit 4377538120d3ad1120ff0509815bfb16596430d5
Author: Matthieu Baerts (NGI0) <matttbe@kernel.org>

mptcp: count orphans as TCP does

This commit accounts for orphaned MPTCP sockets in tcp_orphan_count and
resets them via mptcp_orphan_oom() when orphan or TCP memory limits are
exceeded at close() or after the close timeout expires.

> 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
[ ... ]
> @@ -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 calling mptcp_do_fastclose() here fail to reset the subflow when
mptcp_orphan_oom() triggers on a fallback socket?

On a fallback socket, mptcp_do_fastclose() sets sk->sk_state to TCP_CLOSE
and msk->fastclosing = 1, then returns early without resetting ssk or
setting subflow->send_fastclose:

net/mptcp/protocol.c:mptcp_do_fastclose() {
	mptcp_set_state(sk, TCP_CLOSE);
	mptcp_backlog_purge(sk);
	msk->fastclosing = 1;

	/* Explicitly send the fastclose reset as need */
	if (__mptcp_check_fallback(msk))
		return;
    ...
}

Because sk->sk_state is now TCP_CLOSE, __mptcp_close() immediately calls
__mptcp_destroy_sock() -> mptcp_destroy(), which sets msk->free_first = 1
and runs __mptcp_clear_xmit() and __mptcp_close_ssk().  With
msk->free_first set and subflow->send_fastclose unset, __mptcp_close_ssk()
skips __mptcp_subflow_disconnect() and calls __tcp_close(ssk, 0) on the
still-open subflow.

If msk->rtx_queue had unpushed data, __mptcp_clear_xmit() discards it
before __tcp_close(ssk, 0) sends a clean TCP FIN after the truncated stream
(leaving ssk alive in TCP_FIN_WAIT1 if freeing msk->rtx_queue relieved the
memory pressure), or __tcp_close(ssk, 0) hits tcp_check_oom() again and
double-increments LINUX_MIB_TCPABORTONMEMORY.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-net-mptcp-misc-fixes-7-4-rc7-v1-0-9f03efcb1a17@kernel.org?part=4

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

Thread overview: 25+ 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-04 12:04     ` Matthieu Baerts
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-04 12:04     ` Matthieu Baerts
2026-12-02 21:29 ` [PATCH net 4/9] mptcp: count orphans as TCP does Matthieu Baerts (NGI0)
2026-12-03 21:32   ` sashiko-bot [this message]
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-04 12:04     ` Matthieu Baerts
2026-12-02 21:29 ` [PATCH net 5/9] mptcp: return EOF after a DATA_FIN, " Matthieu Baerts (NGI0)
2026-12-03 21:32   ` sashiko-bot
2026-12-03 21:51   ` netdev-bot+sashiko
2026-12-04 12:04     ` Matthieu Baerts
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
2026-12-04 12:05     ` Matthieu Baerts
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-04 12:05     ` Matthieu Baerts
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)
2026-12-04 12:05 ` [PATCH net 0/9] mptcp: misc fixes for v7.4-rc7 Matthieu Baerts

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=sashiko-outbox-248693@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=matttbe@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.