All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "T S Rameshkumar" <rameshsv06@gmail.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH] mptcp: push queued data on passive TFO subflows becoming established
Date: Thu, 08 Oct 2026 10:03:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-163983@kernel.org> (raw)
In-Reply-To: <20261008095231.103186-1-rameshkumar.t@phytecembedded.in>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] mptcp: data race on cb_flags due to mixed atomic and non-atomic bitops
- [Medium] mptcp: unintended worker scheduling on all TCP state changes for TFO subflows
--

commit ae556f46010534274aa7940f77f235a6807ae115
Author: T S Rameshkumar <rameshsv06@gmail.com>

mptcp: push queued data on passive TFO subflows becoming established

With TCP Fast Open on an MPTCP listener, if the server application writes
data while the passive subflow is still in SYN_RECV, the data is queued.
This patch attempts to push stranded data when the underlying subflow
transitions to established by modifying cb_flags and scheduling the MPTCP
worker.

Closes: https://lore.kernel.org/netdev/CAFPPu1gU2Y-D+d4i3F0MoNkYK+e1U+=X3qf6QycjfKBw+8snPg@mail.gmail.com/

> diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
> index f0a6725d2c376..f499073a62d7c 100644
> --- a/net/mptcp/subflow.c
> +++ b/net/mptcp/subflow.c
[ ... ]
> @@ -1894,6 +1894,11 @@ static void subflow_state_change(struct sock *sk)
>  	if (subflow->resetting)
>  		return;
>  
> +	if (subflow->is_mptfo) {

[Severity: Medium]
Since subflow->is_mptfo is never cleared and there is no check for
sk->sk_state == TCP_ESTABLISHED here, won't this trigger on every subsequent
TCP state change?

The commit message states this logic is intended specifically for when "the
underlying subflow transitions to TCP_ESTABLISHED", but without checking the
state, this could fire erroneously and schedule the worker when transitioning
into shutdown states like TCP_FIN_WAIT1, TCP_CLOSE_WAIT, or TCP_CLOSE.

> +		set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(parent)->cb_flags);

[Severity: High]
Does mixing atomic and non-atomic bit operations on cb_flags cause data races
and lost updates?

subflow_state_change() uses the atomic set_bit() operation to modify
cb_flags without holding the parent MPTCP socket's mptcp_data_lock.

However, concurrently, other paths modify cb_flags using non-atomic operations
while holding mptcp_data_lock. For example:

net/mptcp/protocol.c:__mptcp_check_push() {
    ...
    } else {
        __set_bit(MPTCP_PUSH_PENDING, &mptcp_sk(sk)->cb_flags);
    }
}

If the atomic set_bit() occurs between the load and store of the non-atomic
operation, the newly set bit will be clobbered and permanently lost, which
could lead to stranded data or missing wakeups.

> +		mptcp_schedule_work(parent);
> +	}
> +
>  	/* as recvmsg() does not acquire the subflow socket for ssk selection

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261008095231.103186-1-rameshkumar.t@phytecembedded.in?part=1

  parent reply	other threads:[~2026-10-08 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  9:52 [PATCH] mptcp: push queued data on passive TFO subflows becoming established T S Rameshkumar
2026-10-08  9:59 ` Petar Sakic
2026-10-08 10:03 ` sashiko-bot [this message]
2026-10-08 10:56 ` MPTCP CI
2026-10-12 10:21 ` netdev-bot+sashiko
  -- strict thread matches above, loose matches on Subject: below --
2026-10-08  8:59 Bug report mptcp: passive TFO: data written by the server before the MPC third ACK is never sent Petar Sakic
2026-10-08 10:05 ` [PATCH] mptcp: push queued data on passive TFO subflows becoming established T S Rameshkumar

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-163983@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=rameshsv06@gmail.com \
    --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.