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-next v27 6/8] mptcp: remove CB offset field
Date: Mon, 16 Nov 2026 03:44:27 +0000	[thread overview]
Message-ID: <179480066751.3133.13797616529803421975@kernel.org> (raw)
In-Reply-To: <879f04c4a89da0b3e8bcc7fd484744be5851f17e.1794663678.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · 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).

- [Medium] Incomplete conversion of the MPTCP CB sequence fields mixes
  two different keys in the out-of-order (OFO) queue.

--

mptcp: remove CB offset field

This patch replaces the per-skb CB offset field with a new msk-level
copied_seq, which tracks how far the reader has consumed data. In
mptcp_init_skb(), map_seq is now stored as the mapped DSN minus the
subflow offset, and skbs with a non-zero offset are tagged with
MPTCP_SKB_CB_F_OFFSET. New mptcp_dsn() and mptcp_end_dsn() helpers
compute the real DSN range for receive path users.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 41fc2429d2fed..f4ab3bdd368f2 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c

[ ... ]

> @@ -305,8 +306,8 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
>  	u64 seq, end_seq, max_seq;
>  	struct sk_buff *skb1;
>  
> -	seq = MPTCP_SKB_CB(skb)->map_seq;
> -	end_seq = MPTCP_SKB_CB(skb)->end_seq;
> +	seq = mptcp_dsn(skb);
> +	end_seq = mptcp_end_dsn(skb);
>  	max_seq = atomic64_read(&msk->rcv_wnd_sent);

[ ... ]

> @@ -362,8 +363,8 @@ static void mptcp_data_queue_ofo(struct mptcp_sock *msk, struct sk_buff *skb)
>  			p = &parent->rb_left;
>  			continue;
>  		}
> -		if (before64(seq, MPTCP_SKB_CB(skb1)->end_seq)) {
> -			if (!after64(end_seq, MPTCP_SKB_CB(skb1)->end_seq)) {
> +		if (before64(seq, mptcp_end_dsn(skb1))) {
> +			if (!after64(end_seq, mptcp_end_dsn(skb1))) {
>  				/* All the bits are present. Drop. */
>  				mptcp_drop(sk, skb);
>  				MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_DUPDATA);

[Severity: Medium]
The commit message says:

  "Throughout the receive path, direct accesses to
  MPTCP_SKB_CB(skb)->map_seq and end_seq are replaced with calls to
  mptcp_dsn() and mptcp_end_dsn()."

mptcp_init_skb() now stores map_seq as mptcp_subflow_get_mapped_dsn()
minus offset. Can the raw MPTCP_SKB_CB(skb1)->map_seq still be used as a
DSN in this function?

The end checks were converted to mptcp_end_dsn(skb1). The rbtree descent
and the partial-overlap test still read the raw field:

mptcp_data_queue_ofo() {
    ...
		if (before64(seq, MPTCP_SKB_CB(skb1)->map_seq)) {
			p = &parent->rb_left;
			continue;
		}
		if (before64(seq, mptcp_end_dsn(skb1))) {
			if (!after64(end_seq, mptcp_end_dsn(skb1))) {
				/* All the bits are present. Drop. */
    ...
			if (after64(seq, MPTCP_SKB_CB(skb1)->map_seq)) {
				/* partial overlap:
    ...
}

When skb1 has MPTCP_SKB_CB_F_OFFSET set, its raw map_seq M sits offset
bytes below its real DSN D = mptcp_dsn(skb1). Take an incoming skb whose
seq S satisfies M <= S < D:

- If its end is <= mptcp_end_dsn(skb1), it is dropped as
  MPTCP_MIB_DUPDATA. skb1 never delivers [S, D), though.
  __mptcp_ofo_queue() only dequeues skb1 once ack_seq reaches D, and
  readers start at copied_seq - map_seq >= offset.

- If its end is past mptcp_end_dsn(skb1) and S > M, it is linked into
  skb1's right subtree even though S < D.

In the second case, __mptcp_ofo_queue() walks the tree in order and
stops at skb1:

		if (after64(mptcp_dsn(skb), msk->ack_seq))
			break;

With ack_seq in [S, D), the in-sequence skb behind skb1 is never moved.
Does the receive path then stall until an MPTCP-level retransmit fills
the hole?

This looks reachable. tcp_data_queue() queues partially overlapping
segments without trimming them, so __mptcp_move_skbs_from_subflow() sees
offset > 0 and mptcp_init_skb() sets MPTCP_SKB_CB_F_OFFSET. If
mptcp_dsn(skb) > ack_seq, the skb goes to the out-of-order queue. A later
out-of-order skb whose DSN starts inside [M, D), for example a
reinjection on another subflow, then takes one of the paths above.

mptcp_prune_ofo_queue() has a similar problem. It still compares raw
values, and each one is shifted by its own offset:

		/* Stop pruning if the incoming skb would land in OoO tail. */
		if (after64(MPTCP_SKB_CB(in_skb)->map_seq,
			    MPTCP_SKB_CB(skb)->map_seq))
			break;

Take an MPTCP_SKB_CB_F_OFFSET in_skb with real DSN D. Out-of-order skbs
with a DSN in (D - offset, D] look like they come after the incoming
data, so they are pruned under memory pressure.

Should both functions use mptcp_dsn() here?

The "Partial packet" guard in __mptcp_move_skb() also still reads the raw
end_seq, while the body uses mptcp_end_dsn():

	if (after64(MPTCP_SKB_CB(skb)->end_seq, msk->ack_seq)) {
		copy_len = mptcp_end_dsn(skb) - msk->ack_seq;
		goto insert;
	}

So an MPTCP_SKB_CB_F_OFFSET skb with
mptcp_end_dsn(skb) - offset <= ack_seq < mptcp_end_dsn(skb) is dropped as
completely old data.

The later patch "mptcp: sync mptcp skb cb layout with tcp one" changes
this guard to after64(mptcp_end_dsn(skb), msk->ack_seq). The map_seq
comparisons in mptcp_data_queue_ofo() and mptcp_prune_ofo_queue() are
still there at the end of the series, as before()/after() on the 32-bit
map_seq.

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

  parent reply	other threads:[~2026-11-16  3:44 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 14:00 [PATCH mptcp-next v27 0/8] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-11-14 14:00 ` [PATCH mptcp-next v27 1/8] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-16  3:44   ` netdev-bot+sashiko
2026-11-14 14:00 ` [PATCH mptcp-next v27 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-16  3:44   ` netdev-bot+sashiko
2026-11-14 14:00 ` [PATCH mptcp-next v27 3/8] mptcp: fix fallback dummy mapping anchor Geliang Tang
2026-11-14 14:01 ` [PATCH mptcp-next v27 4/8] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-11-14 14:01 ` [PATCH mptcp-next v27 5/8] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-11-16  3:44   ` netdev-bot+sashiko
2026-11-14 14:01 ` [PATCH mptcp-next v27 6/8] mptcp: remove CB offset field Geliang Tang
2026-11-14 14:29   ` sashiko-bot
2026-11-16  3:44   ` netdev-bot+sashiko [this message]
2026-11-14 14:01 ` [PATCH mptcp-next v27 7/8] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-11-14 14:41   ` sashiko-bot
2026-11-16  3:44   ` netdev-bot+sashiko
2026-11-14 14:01 ` [PATCH mptcp-next v27 8/8] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-11-16  3:44   ` netdev-bot+sashiko
2026-11-14 15:52 ` [PATCH mptcp-next v27 0/8] Reduce the differences between TCP and MPTCP for TLS usage 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=179480066751.3133.13797616529803421975@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.