MPTCP Linux Development
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: Matthieu Baerts <matttbe@kernel.org>, mptcp@lists.linux.dev
Cc: cui.tao@linux.dev, geliang@kernel.org, cuitao@kylinos.cn,
	Quanye Yang <quanyeyang@proton.me>
Subject: Re: [PATCH mptcp-next 1/2] mptcp: pm: bound extra_subflows admission on userspace PM
Date: Thu, 3 Sep 2026 16:55:55 +0800	[thread overview]
Message-ID: <801d048f-70a3-4b42-8a09-7b81f46d9a22@linux.dev> (raw)
In-Reply-To: <c8c4f667-5d25-4d94-8627-387d4091c8c4@kernel.org>

Hi Matt,

在 2026/9/3 00:39, Matthieu Baerts 写道:
> Hi Tao,
> 
> + cc Quanye
> 
> On 31/08/2026 11:32, Tao Cui wrote:
>> From: Tao Cui <cuitao@kylinos.cn>
>>
>> mptcp_pm_allow_new_subflow() increments the u8 extra_subflows counter
>> for every accepted MP_JOIN on sockets using the userspace PM, without
>> any limit. A peer establishing more than 255 live subflows wraps the
>> counter back to 0, which then makes the underflow guards warn on the
>> next subflow close, and permanently corrupts mptcpi_subflows_total
>> reported to userspace.
>>
>> Refuse new MP_JOINs once the counter has reached U8_MAX, so that it
>> cannot wrap anymore.
>>
>> Fixes: e99c1ca89071 ("mptcp: pm: add WARN_ON_ONCE guards on extra_subflows underflow")
>> Link: https://github.com/multipath-tcp/mptcp_net-next/issues/629
> 
> Do you have a GitHub account? Just to know if we can assign this task to
> you (or just leave a message in the comment section).
> 
>> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
>> ---
>>  net/mptcp/pm.c | 11 +++++++++--
>>  1 file changed, 9 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
>> index 8b68868255c5..3990f6775723 100644
>> --- a/net/mptcp/pm.c
>> +++ b/net/mptcp/pm.c
>> @@ -562,10 +562,17 @@ bool mptcp_pm_allow_new_subflow(struct mptcp_sock *msk)
>>  
>>  	if (mptcp_pm_is_userspace(msk)) {
>>  		if (mptcp_userspace_pm_active(msk)) {
>> +			bool allow;
> 
> "ret" could be re-used here.
> 
>> +
>> +			/* extra_subflows is a u8: don't let a peer wrap it
>> +			 * with more than U8_MAX accepted MP_JOINs
>> +			 */
> 
> I don't think this comment is needed, "< U8_MAX" is probably clear enough.
> 
>>  			spin_lock_bh(&pm->lock);
>> -			pm->extra_subflows++;
>> +			allow = pm->extra_subflows < U8_MAX;
>> +			if (allow)
>> +				pm->extra_subflows++;
>>  			spin_unlock_bh(&pm->lock);
>> -			return true;
>> +			return allow;
>>  		}
>>  		return false;
>>  	}
> 
> So, at the end, we can re-used the same version as Quanye. Would it be
> OK for both of you to have a Co-developed-by tag here?
> 

Thanks for sorting this out with Quanye.

Sounds good to me. I'll send a v2 taking your two comments into
account, reusing "ret" and dropping the comment, with Quanye's
Netlink part as a separate patch with him as author, and
Co-developed-by tags on the admission patch. I'll switch to
"Closes:" for the issue as well.

About the GitHub account: I have one (sharkct235@gmail.com) but
honestly I don't use it much because of the captcha checks, so
sorry in advance if I'm slow to react there. I've left a comment on
the issue, and I'll try to be better at watching it for this kind
of thing.

Thanks,
Tao

> Cheers,
> Matt


  parent reply	other threads:[~2026-09-03  8:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31  9:32 [PATCH mptcp-next 0/2] mptcp: pm: fix reachable extra_subflows guards Tao Cui
2026-08-31  9:32 ` [PATCH mptcp-next 1/2] mptcp: pm: bound extra_subflows admission on userspace PM Tao Cui
2026-09-02 16:39   ` Matthieu Baerts
2026-09-03  3:42     ` quanyeyang
2026-09-03  8:57       ` Tao Cui
2026-09-03  8:55     ` Tao Cui [this message]
2026-09-03  9:13       ` Matthieu Baerts
2026-08-31  9:32 ` [PATCH mptcp-next 2/2] mptcp: pm: skip extra_subflows accounting on disconnected msk Tao Cui
2026-08-31 10:11   ` sashiko-bot
2026-08-31 13:00     ` Tao Cui
2026-09-02 16:32       ` Matthieu Baerts
2026-09-02 16:56   ` Matthieu Baerts
2026-08-31 10:25 ` [PATCH mptcp-next 0/2] 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=801d048f-70a3-4b42-8a09-7b81f46d9a22@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=cuitao@kylinos.cn \
    --cc=geliang@kernel.org \
    --cc=matttbe@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox