All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v22 7/8] mptcp: sync mptcp skb cb layout with tcp one
Date: Fri, 06 Nov 2026 12:04:33 +0000	[thread overview]
Message-ID: <sashiko-outbox-201375@kernel.org> (raw)
In-Reply-To: <20676e77a7ed0b1715bd1b539c21fb396d109a23.1793964796.git.tanggeliang@kylinos.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: uninitialized more_data_avail and stale seq if
  mptcp_init_skb() fails
--

commit 36fc62d77781e7da07f0272cbd92459df3b0613b
Author: Paolo Abeni <pabeni@redhat.com>

mptcp: sync mptcp skb cb layout with tcp one

This commit updates struct mptcp_skb_cb to use 32-bit sequence numbers for
map_seq and end_seq alongside a 64-bit map_seq64 field so that the shared CB
fields match the TCP control buffer layout.

> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index cedc91accc6b4..ced34e8cd25c8 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -433,11 +442,13 @@ static bool mptcp_init_skb(struct sock *ssk, struct sk_buff *skb, int offset)
>  
>  	/* the skb map_seq accounts for the skb offset:
>  	 * mptcp_subflow_get_mapped_dsn() is based on the current tp->copied_seq
> -	 * value
> +	 * value; note that end seq number is only available in 32bits format.
>  	 */
> -	MPTCP_SKB_CB(skb)->map_seq = mptcp_subflow_get_mapped_dsn(subflow) -
> -				     offset;
> +	MPTCP_SKB_CB(skb)->map_seq64 = mptcp_subflow_get_mapped_dsn(subflow) -
> +				       offset;
> +	MPTCP_SKB_CB(skb)->map_seq = (u32)MPTCP_SKB_CB(skb)->map_seq64;
>  	MPTCP_SKB_CB(skb)->end_seq = MPTCP_SKB_CB(skb)->map_seq + skb->len;
> +	MPTCP_SKB_CB(skb)->flags = 0;
>  	MPTCP_SKB_CB(skb)->has_rxtstamp = has_rxtstamp;

[Severity: Medium]
In commit "mptcp: remove CB offset field" earlier in this series, can a
failure in mptcp_init_skb() cause __mptcp_move_skbs_from_subflow() to
evaluate more_data_avail uninitialized and leave tp->copied_seq stale?

net/mptcp/protocol.c:mptcp_init_skb() {
	...
	if (unlikely(offset > 0 &&
		     before(TCP_SKB_CB(skb)->seq - subflow->ssn_offset,
			    subflow->map_subflow_seq))) {
		if (offset >= skb->len || !pskb_pull(skb, offset)) {
			WARN_ON_ONCE(1);
			sk_eat_skb(ssk, skb);
			return false;
		}
		offset = 0;
	}
	...
}

net/mptcp/protocol.c:__mptcp_move_skbs_from_subflow() {
	...
	bool more_data_avail;
	...
	do {
		...
		if (offset < skb->len) {
			size_t len = skb->len - offset;

			if (!mptcp_init_skb(ssk, skb, offset))
				continue;
			...
			seq += len;
			...
		}
		...
		WRITE_ONCE(tp->copied_seq, seq);
		more_data_avail = mptcp_subflow_data_available(ssk);

	} while (more_data_avail);
}

When pskb_pull() fails under memory pressure, mptcp_init_skb() consumes
skb via sk_eat_skb() and returns false.  Taking continue in
__mptcp_move_skbs_from_subflow() jumps straight to while (more_data_avail),
reading more_data_avail uninitialized on the first iteration and skipping
both the tp->copied_seq update and mptcp_subflow_data_available().  Because
skb was already removed from ssk->sk_receive_queue while tp->copied_seq was
not advanced, the next skb on the queue computes an underflowed offset
(>= skb->len), dropping it and triggering mptcp_dss_corruption().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1793964796.git.tanggeliang@kylinos.cn?part=7

  reply	other threads:[~2026-11-06 12:04 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06 11:36 [PATCH mptcp-next v22 0/8] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-11-06 11:36 ` [PATCH mptcp-net v22 1/8] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-06 11:36 ` [PATCH mptcp-next v22 2/8] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-06 11:51   ` sashiko-bot
2026-11-06 11:36 ` [PATCH mptcp-net v22 3/8] mptcp: fix fallback dummy mapping anchor Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 4/8] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 5/8] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-11-06 11:37 ` [PATCH mptcp-next v22 6/8] mptcp: remove CB offset field Geliang Tang
2026-11-06 12:12   ` sashiko-bot
2026-11-06 11:37 ` [PATCH mptcp-next v22 7/8] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-11-06 12:04   ` sashiko-bot [this message]
2026-11-06 11:37 ` [PATCH mptcp-next v22 8/8] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-11-06 13:59 ` [PATCH mptcp-next v22 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=sashiko-outbox-201375@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=geliang@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.