[PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM

Tao Cui posted 2 patches 1 week, 4 days ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/multipath-tcp/mptcp_net-next tags/patchew/20260514132925.410184-1-cuitao@kylinos.cn
There is a newer version of this series
net/mptcp/pm.c           | 3 ++-
net/mptcp/pm_userspace.c | 7 +++++--
net/mptcp/subflow.c      | 3 ++-
3 files changed, 9 insertions(+), 4 deletions(-)
[PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM
Posted by Tao Cui 1 week, 4 days ago
This is v3 of the series that fixes extra_subflows u8 underflow bugs
in the MPTCP userspace path manager.

extra_subflows is a u8 field in struct mptcp_pm_data. Two code paths
in the userspace PM can cause it to underflow from 0 to 255, after
which the counter is permanently corrupted and future subflow
creation is blocked.

Patch 1 skips the spurious mptcp_pm_close_subflow() call in
__mptcp_subflow_connect() when the userspace PM is in use, since it
does not pre-increment extra_subflows before attempting subflow
creation.

Patch 2 moves extra_subflows++ into the lock_sock(sk) section, before
release_sock(sk), so that mptcp_worker always sees a non-zero counter
when closing a subflow.  This eliminates a race where the worker
decrements the counter before the user thread increments it, causing
an underflow.  An underflow guard is also added in
mptcp_pm_subflow_check_next() as a safety net.

Tao Cui (2):
  mptcp: pm: fix extra_subflows underflow on userspace PM connect
    failure
  mptcp: pm: fix extra_subflows leak on userspace PM subflow close race

 net/mptcp/pm.c           | 3 ++-
 net/mptcp/pm_userspace.c | 7 +++++--
 net/mptcp/subflow.c      | 3 ++-
 3 files changed, 9 insertions(+), 4 deletions(-)

---
Changes in v3:
  - Patch 2: move extra_subflows++ before release_sock(sk) to close
    the race window, instead of relying solely on the underflow guard.

Changes in v2:
  - Dropped the use-after-free fix.
  - Split the underflow fix into two patches, one per code path.

v1:
  https://lore.kernel.org/all/20260509075629.217791-2-cuitao@kylinos.cn/
-- 
2.43.0
Re: [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM
Posted by MPTCP CI 1 week, 4 days ago
Hi Tao,

Thank you for your modifications, that's great!

Our CI did some validations and here is its report:

- KVM Validation: normal (except selftest_mptcp_join): Success! ✅
- KVM Validation: normal (only selftest_mptcp_join): Success! ✅
- KVM Validation: debug (except selftest_mptcp_join): Unstable: 2 failed test(s): packetdrill_dss packetdrill_sockopts ⚠️ 
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/25863948276

Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/dec78c185606
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1094801


If there are some issues, you can reproduce them using the same environment as
the one used by the CI thanks to a docker image, e.g.:

    $ cd [kernel source code]
    $ docker run -v "${PWD}:${PWD}:rw" -w "${PWD}" --privileged --rm -it \
        --pull always mptcp/mptcp-upstream-virtme-docker:latest \
        auto-normal

For more details:

    https://github.com/multipath-tcp/mptcp-upstream-virtme-docker


Please note that despite all the efforts that have been already done to have a
stable tests suite when executed on a public CI like here, it is possible some
reported issues are not due to your modifications. Still, do not hesitate to
help us improve that ;-)

Cheers,
MPTCP GH Action bot
Bot operated by Matthieu Baerts (NGI0 Core)
Re: [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM
Posted by Jakub Kicinski 1 week, 4 days ago
On Thu, 14 May 2026 21:29:23 +0800 Tao Cui wrote:
> To: matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com

Please don't CC maintainers without CCing the mailing list associated
with their area. If you're CCing core networking maintainers you should
also CC netdev@
Re: [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM
Posted by Matthieu Baerts 1 week, 4 days ago
Hi Tao,

14 May 2026 17:02:20 Jakub Kicinski <kuba@kernel.org>:

> On Thu, 14 May 2026 21:29:23 +0800 Tao Cui wrote:
>> To: matttbe@kernel.org, martineau@kernel.org, geliang@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com
>
> Please don't CC maintainers without CCing the mailing list associated
> with their area. If you're CCing core networking maintainers you should
> also CC netdev@

Indeed, thank you. And if you are using the mptcp-next prefix, please
don't cc the netdev mailing list.

Cheers,
Matt