From: Matthieu Baerts <matttbe@kernel.org>
To: Tao Cui <cui.tao@linux.dev>, mptcp@lists.linux.dev, quanyeyang@proton.me
Cc: geliang@kernel.org, cuitao@kylinos.cn
Subject: Re: [PATCH mptcp-next v2 3/3] mptcp: pm: userspace: cap extra_subflows on Netlink subflow creation
Date: Thu, 3 Sep 2026 16:13:01 +0200 [thread overview]
Message-ID: <e962d225-caf9-4be6-af80-e7cc0f34a2ec@kernel.org> (raw)
In-Reply-To: <20260903131416.1112393-4-cui.tao@linux.dev>
Hi Tao, Quanye,
On 03/09/2026 15:14, Tao Cui wrote:
> From: Quanye Yang <quanyeyang@proton.me>
>
> mptcp_pm_nl_subflow_create_doit() also increments the u8 extra_subflows
> counter without any limit: a client with CAP_NET_ADMIN can create more
> than 255 extra subflows via Netlink and wrap the counter back to 0,
> with the same effects as the MP_JOIN path now bounded separately:
> the underflow guards warn on the next subflow close, and
> mptcpi_subflows_total reported to userspace is corrupted.
>
> Refuse the subflow creation with -ENOSPC once the counter has reached
> U8_MAX, and clean up the local address entry in that case as well.
>
> Fixes: 77e4b94a3de6 ("mptcp: update userspace pm infos")
> Link: https://lore.kernel.org/all/20260902-mptcp-pm-extra-subflows-v1-1-68540a866e5a@proton.me/
> Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/629
>
(no empty line here)
> Signed-off-by: Quanye Yang <quanyeyang@proton.me>
> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
> ---
> net/mptcp/pm_userspace.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/net/mptcp/pm_userspace.c b/net/mptcp/pm_userspace.c
> index b94fbb483bf9..3371e17d01b9 100644
> --- a/net/mptcp/pm_userspace.c
> +++ b/net/mptcp/pm_userspace.c
> @@ -417,6 +417,12 @@ 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);
> + if (msk->pm.extra_subflows == U8_MAX) {
> + spin_unlock_bh(&msk->pm.lock);
> + GENL_SET_ERR_MSG(info, "too many extra subflows");
> + err = -ENOSPC;
> + goto delete_addr;
> + }
> msk->pm.extra_subflows++;
> spin_unlock_bh(&msk->pm.lock);
>
> @@ -424,9 +430,11 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info)
> err = __mptcp_subflow_connect(sk, &local, &addr_r);
> release_sock(sk);
>
> - if (err) {
> + if (err)
> GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err);
>
> +delete_addr:
Can you not have the label inside the if-statement?
if (err) {
GENL_SET_ERR_MSG_FMT(info, "connect error: %d", err);
delete_addr:
(...)
> + if (err) {
> spin_lock_bh(&msk->pm.lock);
> mptcp_userspace_pm_delete_local_addr(msk, &entry);
Maybe you can add something in the commit message for the reviewers:
The same error path is followed after
mptcp_userspace_pm_append_new_local_addr, which should probably not
delete the local address unconditionally, but this is a pre-existing
issue that will be addressed separately.
> spin_unlock_bh(&msk->pm.lock);
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2026-09-03 14:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 13:14 [PATCH mptcp-next v2 0/3] mptcp: pm: fix reachable extra_subflows guards Tao Cui
2026-09-03 13:14 ` [PATCH mptcp-next v2 1/3] mptcp: pm: bound extra_subflows admission on userspace PM Tao Cui
2026-09-03 13:14 ` [PATCH mptcp-next v2 2/3] mptcp: pm: skip extra_subflows accounting on disconnected msk Tao Cui
2026-09-03 13:14 ` [PATCH mptcp-next v2 3/3] mptcp: pm: userspace: cap extra_subflows on Netlink subflow creation Tao Cui
2026-09-03 13:27 ` sashiko-bot
2026-09-03 14:08 ` Matthieu Baerts
2026-09-03 14:13 ` Matthieu Baerts [this message]
2026-09-03 14:21 ` [PATCH mptcp-next v2 0/3] mptcp: pm: fix reachable extra_subflows guards 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=e962d225-caf9-4be6-af80-e7cc0f34a2ec@kernel.org \
--to=matttbe@kernel.org \
--cc=cui.tao@linux.dev \
--cc=cuitao@kylinos.cn \
--cc=geliang@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=quanyeyang@proton.me \
/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.