From: sashiko-bot@kernel.org
To: "Geliang Tang" <geliang@kernel.org>, mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next v28 10/11] mptcp: sync mptcp skb cb layout with tcp one
Date: Mon, 16 Nov 2026 08:10:32 +0000 [thread overview]
Message-ID: <sashiko-outbox-216512@kernel.org> (raw)
In-Reply-To: <af0a3423548713de827ea0597b8b637fde99e3b2.1794810809.git.tanggeliang@kylinos.cn>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] mptcp: copied_seq offset underflow in recv path for OoO data
after DATA_FIN
--
commit 4e18ccd1c70ef371066d9f0f5c43875b2c871587
Author: Paolo Abeni <pabeni@redhat.com>
mptcp: sync mptcp skb cb layout with tcp one
This commit aligns struct mptcp_skb_cb with struct tcp_skb_cb by converting
map_seq and end_seq to u32, adding map_seq64 for the 64-bit DSN, and using
32-bit sequence comparisons and offset calculations in the receive path.
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 78ca580c6d9c5..50ae8cdec8a4a 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
[ ... ]
> @@ -2231,7 +2233,7 @@ static int __mptcp_recvmsg_mskq(struct sock *sk, struct msghdr *msg,
> int copied = 0;
>
> skb_queue_walk_safe(&sk->sk_receive_queue, skb, tmp) {
> - u64 offset = *seq - MPTCP_SKB_CB(skb)->map_seq;
> + u32 offset = (u32)(*seq) - MPTCP_SKB_CB(skb)->map_seq;
> u32 data_len = skb->len - offset;
> u32 count;
> int err;
> @@ -4654,7 +4656,7 @@ static struct sk_buff *mptcp_recv_skb(struct sock *sk, u32 *off)
> mptcp_move_skbs(sk);
>
> while ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) {
> - offset = msk->copied_seq - MPTCP_SKB_CB(skb)->map_seq;
> + offset = (u32)msk->copied_seq - MPTCP_SKB_CB(skb)->map_seq;
> if (offset < skb->len) {
> *off = offset;
> return skb;
[Severity: Medium]
Can offset underflow in __mptcp_recvmsg_mskq() and mptcp_recv_skb() when an
out-of-order segment at or after DATA_FIN is queued before the DATA_FIN
arrives?
Commit "mptcp: drop data after DATA_FIN before skb init" checks
mptcp_seq_after_data_fin() when dequeuing from the subflow, which only acts
if msk->rcv_data_fin or RCV_SHUTDOWN is already set. If a peer sends an
out-of-order segment with dsn == rcv_data_fin_seq + 1 before sending the
DATA_FIN, the segment is placed into msk->out_of_order_queue or
msk->backlog_list. Once the DATA_FIN arrives and pre-DATA_FIN data is
received, mptcp_check_data_fin() advances msk->ack_seq to
rcv_data_fin_seq + 1 while msk->copied_seq reaches at most rcv_data_fin_seq.
__mptcp_ofo_queue() or __mptcp_move_skb() then moves that queued segment into
sk->sk_receive_queue and adds its length to msk->bytes_received.
When offset == 0 in mptcp_init_skb(), MPTCP_SKB_CB(skb)->map_seq is
(u32)(rcv_data_fin_seq + 1), so (u32)copied_seq - map_seq underflows to
0xffffffff >= skb->len. Both receive helpers then free the skb via
mptcp_eat_recv_skb() without advancing msk->bytes_consumed, leaving
mptcp_data_avail(msk) non-zero after EOF and causing __mptcp_close() to send
MP_FASTCLOSE. If the subflow skb had a non-zero offset in mptcp_init_skb()
so that map_seq <= (u32)rcv_data_fin_seq, the computed offset is 1 byte too
small, copying a discarded prefix byte to userspace and underflowing
mptcp_data_avail(msk).
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794810809.git.tanggeliang@kylinos.cn?part=10
next prev parent reply other threads:[~2026-11-16 8:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 6:38 [PATCH mptcp-next v28 00/11] Reduce the differences between TCP and MPTCP for TLS usage Geliang Tang
2026-11-16 6:38 ` [PATCH mptcp-net v28 01/11] mptcp: fix TFO SIOCINQ overflow in mptcp_inq_hint Geliang Tang
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:38 ` [PATCH mptcp-next v28 02/11] selftests: mptcp: connect: check TFO SIOCINQ overflow Geliang Tang
2026-11-16 6:57 ` sashiko-bot
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:38 ` [PATCH mptcp-net v28 03/11] mptcp: fix fallback dummy mapping anchor Geliang Tang
2026-11-16 6:38 ` [PATCH mptcp-next v28 04/11] mptcp: drop the mptcp_ooo_try_coalesce() helper Geliang Tang
2026-11-16 6:38 ` [PATCH mptcp-next v28 05/11] mptcp: drop the cant_coalesce CB field Geliang Tang
2026-11-16 6:38 ` [PATCH mptcp-next v28 06/11] mptcp: add flags field to mptcp_skb_cb Geliang Tang
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:39 ` [PATCH mptcp-next v28 07/11] mptcp: encapsulate CB DSN field access with helpers Geliang Tang
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:39 ` [PATCH mptcp-next v28 08/11] mptcp: remove CB offset field Geliang Tang
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:39 ` [PATCH mptcp-next v28 09/11] mptcp: drop data after DATA_FIN before skb init Geliang Tang
2026-11-16 7:37 ` sashiko-bot
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:39 ` [PATCH mptcp-next v28 10/11] mptcp: sync mptcp skb cb layout with tcp one Geliang Tang
2026-11-16 8:10 ` sashiko-bot [this message]
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 6:39 ` [PATCH mptcp-next v28 11/11] mptcp: defer read_sock cleanup to mptcp_worker Geliang Tang
2026-11-17 22:41 ` netdev-bot+sashiko
2026-11-16 8:33 ` [PATCH mptcp-next v28 00/11] 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-216512@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.