All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: geliang@kernel.org
Cc: mptcp@lists.linux.dev, kuba@kernel.org
Subject: Re: [PATCH mptcp-net v2 2/4] mptcp: add missing memory barriers for rcv_data_fin_seq
Date: Tue, 24 Nov 2026 01:05:27 +0000	[thread overview]
Message-ID: <179548232731.3133.14387340969806272954@kernel.org> (raw)
In-Reply-To: <da8ae9e6c48df602b08475d151a87841ad632400.1795348666.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message overstates one failure mode.
- [Low] The commit author address does not match the Signed-off-by
  address.

--

mptcp: add missing memory barriers for rcv_data_fin_seq

This commit adds an smp_wmb() between the rcv_data_fin_seq and
rcv_data_fin stores in mptcp_update_rcv_data_fin(). It also adds a
matching smp_rmb() between the two loads in mptcp_pending_data_fin(),
so readers can't see rcv_data_fin == 1 together with a stale
rcv_data_fin_seq.

> On weakly-ordered
> architectures, the reader could observe rcv_data_fin == 1 with a
> stale (or zero) rcv_data_fin_seq, causing mptcp_check_data_fin()
> to either process the DATA_FIN prematurely or skip it entirely.

[Severity: Low]
Can the "skip it entirely" case actually happen?

In mptcp_check_data_fin(), rcv_data_fin is only cleared on the true
branch of mptcp_pending_data_fin():

net/mptcp/protocol.c:mptcp_check_data_fin() {
    ...
	if (mptcp_pending_data_fin(sk, &rcv_data_fin_seq)) {
		WRITE_ONCE(msk->ack_seq, msk->ack_seq + 1);
		WRITE_ONCE(msk->rcv_data_fin, 0);
    ...
}

So a false negative leaves the DATA_FIN pending. Each writer path also
forces another evaluation later. mptcp_incoming_options() and the
subflow.c callers call mptcp_schedule_work() after
mptcp_update_rcv_data_fin():

	    mptcp_update_rcv_data_fin(msk, mp_opt.data_seq, mp_opt.dsn64))
		mptcp_schedule_work((struct sock *)msk);

The other subflow.c writers are followed on the same CPU by the check
in move_skbs_to_msk():

	if (mptcp_pending_data_fin(sk, NULL))
		mptcp_schedule_work(sk);

>From that, a stale read only seems to delay the DATA_FIN.

The real problem looks like the premature case. If the reader sees
rcv_data_fin == 1 with the initial rcv_data_fin_seq of 0, then
!before64(ack_seq, 0) is true whenever bit 63 of ack_seq is clear.
mptcp_check_data_fin() then bumps ack_seq, sets RCV_SHUTDOWN and moves
the msk to CLOSE_WAIT, CLOSING or CLOSE before all data has arrived.
The application would see an early EOF or truncated data.

Since this carries a Fixes: tag, could the commit message describe that
user-visible effect instead of the "skip it entirely" wording?

> Signed-off-by: Geliang Tang <tanggeliang@kylinos.cn>

[Severity: Low]
This isn't a bug, but the author address doesn't match the sign-off.
The author is "Geliang Tang <geliang@kernel.org>", and the only
Signed-off-by is "Geliang Tang <tanggeliang@kylinos.cn>".

checkpatch.pl will warn about this with FROM_SIGN_OFF_MISMATCH. The
in-body "From: Geliang Tang <tanggeliang@kylinos.cn>" line may have
been dropped.

Could that From: line be restored, or a matching Signed-off-by added?
The other patches in the series seem to have the same mismatch.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795348666.git.tanggeliang%40kylinos.cn

  reply	other threads:[~2026-11-24  1:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22 12:07 [PATCH mptcp-net v2 0/4] mptcp: fixes for SIOCINQ Geliang Tang
2026-11-22 12:07 ` [PATCH mptcp-net v2 1/4] mptcp: handle ack_seq advancing past rcv_data_fin_seq Geliang Tang
2026-11-24  1:05   ` netdev-bot+sashiko
2026-11-22 12:07 ` [PATCH mptcp-net v2 2/4] mptcp: add missing memory barriers for rcv_data_fin_seq Geliang Tang
2026-11-24  1:05   ` netdev-bot+sashiko [this message]
2026-11-22 12:07 ` [PATCH mptcp-net v2 3/4] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-22 12:21   ` sashiko-bot
2026-11-24  1:05   ` netdev-bot+sashiko
2026-11-22 12:07 ` [PATCH mptcp-net v2 4/4] mptcp: add mptcp_inq() for SIOCINQ Geliang Tang
2026-11-24  1:05   ` netdev-bot+sashiko
2026-11-22 14:26 ` [PATCH mptcp-net v2 0/4] mptcp: fixes " MPTCP CI

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=179548232731.3133.14387340969806272954@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=geliang@kernel.org \
    --cc=kuba@kernel.org \
    --cc=mptcp@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.