From: sashiko-bot@kernel.org
To: "Kalpan Jani" <kalpan.jani@mpiricsoftware.com>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH net-next v5] mptcp: normalize seq numbers reported in mptcp_info
Date: Thu, 03 Sep 2026 11:11:06 +0000 [thread overview]
Message-ID: <20260903111106.ACCC11F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260903105515.906187-1-kalpan.jani@mpiricsoftware.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Accessing `msk->first` locklessly under `mptcp_data_lock(sk)` without `READ_ONCE()` or RCU protection leads to a TOCTOU double-fetch, resulting in a NULL pointer dereference or Use-After-Free.
- [Critical] The commit intentionally changes the semantics of UAPI fields `mptcpi_write_seq`, `mptcpi_snd_una`, and `mptcpi_rcv_nxt`, breaking userspace tools.
--
commit 7b94bc72d17bfabfa214a5c1eff0721e3dd01eea
Author: Kalpan Jani <kalpan.jani@mpiricsoftware.com>
Subject: mptcp: normalize seq numbers reported in mptcp_info
This commit normalizes the data sequence numbers reported via mptcp_info
by subtracting the initial sequence numbers. It avoids caching the initial
numbers on the socket by reading them from the subflow context under the
data lock.
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/445
> Note: this changes the semantics of mptcpi_write_seq, mptcpi_snd_una
> and mptcpi_rcv_nxt. They no longer report the raw on-the-wire MPTCP
> data sequence numbers, but values relative to the connection's
> initial sequence numbers. This is intentional. Tools that correlate
> these fields directly against captured DSS sequence numbers (e.g.
> via tcpdump) will need to account for the offset;
[Severity: Critical]
Does changing these UAPI fields from absolute on-the-wire sequence numbers
to relative offsets break the ABI for existing userspace tools?
The commit message notes that tools correlating these fields against captured
DSS sequence numbers will need to update how they account for the offset.
Will this break backwards compatibility for existing deployed userspace
applications that expect the previous behavior?
> diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
> index fcf6feb2a9eb5..1e0a5e06bb8a1 100644
> --- a/net/mptcp/sockopt.c
> +++ b/net/mptcp/sockopt.c
[ ... ]
> @@ -1008,9 +1009,19 @@ void mptcp_diag_fill_info(struct mptcp_sock *msk, struct mptcp_info *info)
> info->mptcpi_flags = flags;
>
> slow = lock_sock_fast(sk);
[ ... ]
> info->mptcpi_last_data_recv = jiffies_to_msecs(now - msk->last_data_recv);
> unlock_sock_fast(sk, slow);
>
> mptcp_data_lock(sk);
> + if (msk->first) {
> + struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(msk->first);
[Severity: Critical]
Can this sequence cause a NULL pointer dereference due to a race with
__mptcp_close_ssk()?
The commit message states that the transition of msk->first to NULL cannot be
observed mid-flight because mptcp_close() holds the same socket lock that
this function acquires via lock_sock_fast().
However, unlock_sock_fast() releases that lock right before acquiring the
spinlock mptcp_data_lock().
If a concurrent thread running mptcp_close() proceeds to __mptcp_close_ssk()
and executes WRITE_ONCE(msk->first, NULL) without holding mptcp_data_lock():
net/mptcp/protocol.c:__mptcp_close_ssk() {
...
if (ssk == msk->first)
WRITE_ONCE(msk->first, NULL);
...
}
Could msk->first be modified to NULL between the if check and the dereference
since READ_ONCE() is not used here under the spinlock?
If the first fetch is non-NULL and the second fetch is NULL,
mptcp_subflow_ctx() would compute a negative offset, leading to a crash when
accessing subflow->iasn.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903105515.906187-1-kalpan.jani@mpiricsoftware.com?part=1
next prev parent reply other threads:[~2026-09-03 11:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 10:55 [PATCH net-next v5] mptcp: normalize seq numbers reported in mptcp_info Kalpan Jani
2026-09-03 11:11 ` sashiko-bot [this message]
2026-09-03 12:01 ` 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=20260903111106.ACCC11F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=kalpan.jani@mpiricsoftware.com \
--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.