All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM
@ 2026-05-14 13:29 Tao Cui
  2026-05-14 13:29 ` [PATCH mptcp-next v3 1/2] mptcp: pm: fix extra_subflows underflow on userspace PM connect failure Tao Cui
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Tao Cui @ 2026-05-14 13:29 UTC (permalink / raw)
  To: matttbe, martineau, geliang, davem, edumazet, kuba, pabeni
  Cc: horms, mptcp, Tao Cui

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-14 16:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 13:29 [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM Tao Cui
2026-05-14 13:29 ` [PATCH mptcp-next v3 1/2] mptcp: pm: fix extra_subflows underflow on userspace PM connect failure Tao Cui
2026-05-14 13:29 ` [PATCH mptcp-next v3 2/2] mptcp: pm: fix extra_subflows leak on userspace PM subflow close race Tao Cui
2026-05-14 14:02 ` [PATCH mptcp-next v3 0/2] mptcp: pm: fix extra_subflows underflow for userspace PM Jakub Kicinski
2026-05-14 16:00   ` Matthieu Baerts
2026-05-14 14:44 ` MPTCP CI

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.