From: Matthieu Baerts <matttbe@kernel.org>
To: Tao Cui <cui.tao@linux.dev>
Cc: cuitao@kylinos.cn, geliang@kernel.org, mptcp@lists.linux.dev
Subject: Re: [PATCH net-next 01/11] mptcp: pm: add WARN_ON_ONCE guards on extra_subflows underflow
Date: Fri, 28 Aug 2026 11:14:24 +0200 [thread overview]
Message-ID: <9de4df76-3ee2-45c4-b0f5-1afa968c098c@kernel.org> (raw)
In-Reply-To: <20260828083352.292492-1-cui.tao@linux.dev>
Hi Tao,
On 28/08/2026 10:33, Tao Cui wrote:
> From: Tao Cui <cuitao@kylinos.cn>
>
> Hi Matt,
>
>> On 22/05/2026 10:50, Tao Cui wrote:
>>> extra_subflows is a u8 counter that can underflow if a decrement races
>>> with or precedes an increment. While the recently fixed userspace PM
>>> subflow creation path eliminated the primary cause, add defensive
>>> WARN_ON_ONCE guards at both decrement sites to catch any remaining edge
>>> cases rather than silently wrapping to 255.
>>
>> FYI, Clashiko found some existing issues linked to this patch:
>>
>> https://github.com/multipath-tcp/mptcp_net-next/issues/629
>>
>> I don't know if it impacts your case, but just to avoid having multiple
>> people looking at it, do you plan to address Clashiko's comments?
>
> Thanks for the pointer, I had missed that issue.
>
> I had another look and yes, I'll take care of it. Both findings look
> real to me:
>
> The disconnect() race is the nasty one. The MP_JOIN softirq bumps the
> counter under pm->lock and defers the subflow to the join list, then
> mptcp_pm_data_reset() zeroes it with only the socket lock held, and
> the subflow gets closed later at release_sock() time when the join
> list is flushed. So we hit the new warn with the counter already at 0.
> With panic_on_warn that's a remotely triggerable panic, which is
> arguably worse than the silent wrap we had before.
>
> The unbounded increment on the userspace PM side is pre-existing, but
> now the wrap also lands on the warn instead of just corrupting
> mptcpi_subflows_total.
>
> I don't think we want to keep WARN_ON_ONCE() on paths we know are
> reachable. My plan for a fix series:
>
> - refuse new MP_JOINs on the userspace PM once extra_subflows is at
> U8_MAX, so the counter can't wrap anymore
> - sort out the accounting across disconnect (reset vs join list
> drain) and downgrade the warn to a clamp, maybe with a
> pr_warn_ratelimited() to keep some trace of it
>
> I'll follow up in the issue once I have patches. No strong opinion
> between clamping and refusing admission at the limit, happy to go
> with whatever you prefer.
Thank you for having checked and looking at fixes!
Note that for the disconnect part, maybe other variables could be
checked before looking at decrementing the PM counters? e.g. the msk
state? Would that work?
Note that I think we would prefer a pr_warn_ratelimited over a complex
fix involving more locks.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2026-08-28 9:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-22 8:50 [PATCH mptcp-next] mptcp: pm: add WARN_ON_ONCE guards on extra_subflows underflow Tao Cui
2026-05-22 10:31 ` MPTCP CI
2026-05-27 11:40 ` Matthieu Baerts
2026-08-26 13:52 ` Matthieu Baerts
2026-08-28 8:33 ` [PATCH net-next 01/11] " Tao Cui
2026-08-28 9:14 ` Matthieu Baerts [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-08-12 14:55 [PATCH net-next 00/11] mptcp: misc. features for v7.3 Matthieu Baerts (NGI0)
2026-08-12 14:55 ` [PATCH net-next 01/11] mptcp: pm: add WARN_ON_ONCE guards on extra_subflows underflow Matthieu Baerts (NGI0)
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=9de4df76-3ee2-45c4-b0f5-1afa968c098c@kernel.org \
--to=matttbe@kernel.org \
--cc=cui.tao@linux.dev \
--cc=cuitao@kylinos.cn \
--cc=geliang@kernel.org \
--cc=mptcp@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.