FAILED: patch "[PATCH] mptcp: pm: fix extra_subflows underflow on userspace PM" failed to apply to 6.6-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.6-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y
git checkout FETCH_HEAD
git cherry-pick -x 14e9fea30b68fc75b2b3d97396a7e6adb544bd2a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026061555-garland-jailbird-8f3c@gregkh' --subject-prefix 'PATCH 6.6.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 14e9fea30b68fc75b2b3d97396a7e6adb544bd2a Mon Sep 17 00:00:00 2001
From: Tao Cui <[email protected]>
Date: Tue, 2 Jun 2026 22:14:12 +1000
Subject: [PATCH] mptcp: pm: fix extra_subflows underflow on userspace PM
subflow creation
The userspace PM increments extra_subflows after __mptcp_subflow_connect() succeeds, but __mptcp_subflow_connect() calls mptcp_pm_close_subflow() on failure to roll back the pre-increment done by the kernel PM's fill_*() helpers. Because the userspace PM hasn't incremented yet at that point, this decrement is spurious and causes extra_subflows to underflow.
Fix it by aligning the userspace PM with the kernel PM: increment extra_subflows before calling __mptcp_subflow_connect(), so the existing error path in subflow.c correctly rolls it back on failure. Also simplify the error handling by taking pm.lock only when needed for cleanup.
net/mptcp/pm_userspace.c +8 -6
@@ -408,19 +408,21 @@ int mptcp_pm_nl_subflow_create_doit(struct sk_buff *skb, struct genl_info *info) local.flags = entry.flags; local.ifindex = entry.ifindex; +spin_lock_bh (&msk->pm.lock); + msk->pm.extra_subflows++; +spin_unlock_bh (&msk->pm.lock); +lock_sock (sk); 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); -spin_lock_bh (&msk->pm.lock); -if (err) +spin_lock_bh (&msk->pm.lock);mptcp_userspace_pm_delete_local_addr (msk, &entry); -else - msk->pm.extra_subflows++; -spin_unlock_bh (&msk->pm.lock); +spin_unlock_bh (&msk->pm.lock); + } create_err:sock_put (sk);
Sasha Levin
maintainerPATCH 1/1 mptcp: pm: fix extra_subflows underflow on userspace PM subflow creation
From: Tao Cui <[email protected]>
[ Upstream commit 14e9fea30b68fc75b2b3d97396a7e6adb544bd2a ]
The userspace PM increments extra_subflows after __mptcp_subflow_connect() succeeds, but __mptcp_subflow_connect() calls mptcp_pm_close_subflow() on failure to roll back the pre-increment done by the kernel PM's fill_*() helpers. Because the userspace PM hasn't incremented yet at that point, this decrement is spurious and causes extra_subflows to underflow.
Fix it by aligning the userspace PM with the kernel PM: increment extra_subflows before calling __mptcp_subflow_connect(), so the existing error path in subflow.c correctly rolls it back on failure. Also simplify the error handling by taking pm.lock only when needed for cleanup.
--- net/mptcp/pm_userspace.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/mptcp/pm_userspace.c +8 -5
@@ -408,18 +408,21 @@ int mptcp_nl_cmd_sf_create(struct sk_buff *skb, struct genl_info *info) goto create_err; } +spin_lock_bh (&msk->pm.lock); + msk->pm.subflows++; +spin_unlock_bh (&msk->pm.lock); +lock_sock (sk); err =__mptcp_subflow_connect (sk, &addr_l, &addr_r);release_sock (sk); -spin_lock_bh (&msk->pm.lock); -if (err) +if (err) { +spin_lock_bh (&msk->pm.lock);mptcp_userspace_pm_delete_local_addr (msk, &local); -else - msk->pm.subflows++; -spin_unlock_bh (&msk->pm.lock); +spin_unlock_bh (&msk->pm.lock); + } create_err:sock_put ((struct sock *)msk);
Signature · 1 line
2.53.0