From: sashiko-bot@kernel.org
To: "Quanye Yang" <quanyeyang@proton.me>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-net] mptcp: pm: cap userspace extra_subflows at U8_MAX
Date: Wed, 02 Sep 2026 15:49:19 +0000 [thread overview]
Message-ID: <20260902154920.52DCD1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260902-mptcp-pm-extra-subflows-v1-1-68540a866e5a@proton.me>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Error paths in mptcp_pm_nl_subflow_create_doit unconditionally delete pre-existing local addresses, corrupting state and underflowing local_addr_used.
--
commit 09af196be93604649e0aad5970acd8810bf5dcca
Author: Quanye Yang <quanyeyang@proton.me>
mptcp: pm: cap userspace extra_subflows at U8_MAX
The userspace PM increments extra_subflows with no upper bound. The
field is a u8, so the 256th extra subflow wraps the counter to 0 and
the next close hits WARN_ON_ONCE().
Link: https://github.com/multipath-tcp/mptcp_net-next/issues/629
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index fab16d953dbfe..6d798dd967029 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -427,16 +427,22 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
> local.ifindex = entry.ifindex;
>
> spin_lock_bh(&msk->pm.lock);
> - msk->pm.extra_subflows++;
> - spin_unlock_bh(&msk->pm.lock);
> + if (msk->pm.extra_subflows == U8_MAX) {
> + spin_unlock_bh(&msk->pm.lock);
> + GENL_SET_ERR_MSG(info, "too many extra subflows");
> + err = -ENOSPC;
> + } else {
> + msk->pm.extra_subflows++;
> + spin_unlock_bh(&msk->pm.lock);
>
> - lock_sock(sk);
> - err = __mptcp_subflow_connect(sk, &local, &addr_r);
> - release_sock(sk);
> + lock_sock(sk);
> + err = __mptcp_subflow_connect(sk, &local, &addr_r);
> + release_sock(sk);
> + if (err)
> + GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err);
> + }
>
> if (err) {
> - GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err);
> -
> spin_lock_bh(&msk->pm.lock);
> mptcp_userspace_pm_delete_local_addr(msk, &entry);
> spin_unlock_bh(&msk->pm.lock);
[Severity: High]
This is a pre-existing issue, but does this error path incorrectly delete
pre-existing local addresses?
If a user issues MPTCP_PM_CMD_SUBFLOW_CREATE using a local address that was
already appended, mptcp_userspace_pm_append_new_local_addr() returns success
without allocating a new entry or incrementing local_addr_used.
However, if the new subflow connection fails (or if the newly introduced
extra_subflows == U8_MAX limit is hit), the error handling path blindly invokes
mptcp_userspace_pm_delete_local_addr(msk, &entry) inside
mptcp_pm_nl_subflow_create_doit().
Will this inadvertently destroy pre-existing PM state for existing subflows
relying on that address, and underflow the 8-bit msk->pm.local_addr_used
counter since it wasn't incremented?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260902-mptcp-pm-extra-subflows-v1-1-68540a866e5a@proton.me?part=1
next prev parent reply other threads:[~2026-09-02 15:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 15:39 [PATCH mptcp-net] mptcp: pm: cap userspace extra_subflows at U8_MAX Quanye Yang
2026-09-02 15:39 ` Quanye Yang via B4 Relay
2026-09-02 15:49 ` sashiko-bot [this message]
2026-09-02 16:36 ` Matthieu Baerts
2026-09-02 16:52 ` Matthieu Baerts
2026-09-02 17:02 ` 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=20260902154920.52DCD1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=quanyeyang@proton.me \
--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.