FAILED: patch "[PATCH] mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-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.12.y
git checkout FETCH_HEAD
git cherry-pick -x 2ac7d6e620764f1fc79eb4edd3610a7a661981ca
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026091602-garbage-gumdrop-1752@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 2ac7d6e620764f1fc79eb4edd3610a7a661981ca Mon Sep 17 00:00:00 2001
From: Kalpan Jani <[email protected]>
Date: Tue, 8 Sep 2026 16:07:09 +0200
Subject: [PATCH] mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0
The in-kernel MPTCP path manager can leave a stale ADD_ADDR announcement entry alive when removing the id 0 endpoint. This happens because the id 0 removal path does not tear down pending announcements, unlike the non-zero id path.
When the PM later reselects id 0 after adding another signal endpoint, it finds the stale anno_list entry and hits WARN_ON_ONCE(mptcp_pm_is_kernel()) in mptcp_pm_announced_alloc().
Root cause: asymmetry between removal paths.
- Non-zero id path: mptcp_nl_remove_subflow_and_signal_addr() calls mptcp_pm_remove_announced() to clean up.
- Id 0 path: mptcp_nl_remove_id_zero_address() skips cleanup entirely.
Fix by making the id 0 path symmetric: call mptcp_pm_announced_remove() and decrement add_addr_signaled before queuing the RM_ADDR.
Subtle detail: signal endpoints are stored in anno_list with port 0, but msk_local carries the connection's local port. In other words, entries linked to ID0 paths should have port == 0. A follow-up patch will ensure that. mptcp_pm_announced_remove() uses use_port=true for comparison. So clear the port before the lookup.
net/mptcp/pm_kernel.c +8 -0
@@ -1137,6 +1137,8 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,while ((msk =mptcp_token_iter_next (net, &s_slot, &s_num)) !=NULL ) {struct sock *sk = (struct sock *)msk;struct mptcp_addr_info msk_local; +struct mptcp_addr_info anno_addr; +bool announced;if (list_empty (&msk->conn_list) ||mptcp_pm_is_userspace (msk)) goto next;
@@ -1146,7 +1148,13 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, goto next;lock_sock (sk); +/* Drop a possibly pending ADD_ADDR for this address. */ + anno_addr = msk_local; + anno_addr.port =0 ; + announced =mptcp_pm_announced_remove (msk, &anno_addr);spin_lock_bh (&msk->pm.lock); +if (announced) + msk->pm.add_addr_signaled--;mptcp_pm_remove_addr (msk, &list);mptcp_pm_rm_subflow (msk, &list);__mark_subflow_endp_available (msk,0 );
Sasha Levin
maintainerPATCH 1/3 mptcp: pm: use for_each_subflow helper
From: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit f81689172429885d6c2c7c3dd4926ec626e794bb ]
Similar to most places in the MPTCP code. So instead of passing the subflow list and use list_for_each_entry(subflow, list, node), pass the msk and use mptcp_for_each_subflow(msk, subflow).
That's clearer and more uniform with the rest.
While at it, add 'pm_' prefix for the exported one to easily identify the origin. Plus replace 'lookup' by 'has', because a bool is returned.
Stable backport adaptation for 2ac7d6e620764f1fc79eb4edd3610a7a661981ca:
The stable tree keeps both subflow lookups and their callers in pm_netlink.c. Apply the iterator conversion there, retaining private helpers and using has_subflow_saddr() for the source-address lookup. Drop the upstream pm.c, pm_userspace.c and protocol.h hunks, which assume helper moves and a userspace callback not present on this branch.
Rename pm_netlink.c to pm_kernel.c and update the Makefile so the target patch finds its existing ID0 removal function at the upstream path. Rename the existing remove_anno_list_by_saddr() and mptcp_pm_nl_rm_subflow_received() helpers to mptcp_pm_announced_remove() and mptcp_pm_rm_subflow(), updating all callers, to provide the target's helper name and patch context. Keep their stable implementations and static linkage. No functions are added and the ID0 fix itself remains for the target commit.
[ sashal: Reduced backport -- upstream f816891724298 touches 4 file(s), this
backport carries 2. Not backported here:
net/mptcp/pm.c
net/mptcp/pm_userspace.c
net/mptcp/protocol.h
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: 2ac7d6e62076 ("mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0")
---
net/mptcp/Makefile | 2 +-
net/mptcp/{pm_netlink.c => pm_kernel.c} | 41 ++++++++++++-------------
2 files changed, 21 insertions(+), 22 deletions(-)
rename net/mptcp/{pm_netlink.c => pm_kernel.c} (98%)net/mptcp/Makefile +1 -1
@@ -2,7 +2,7 @@ obj-$(CONFIG_MPTCP) += mptcp.o mptcp-y := protocol.o subflow.o options.o token.o crypto.o ctrl.o pm.o diag.o \ - mib.o pm_netlink.o sockopt.o pm_userspace.o fastopen.o sched.o \ + mib.o pm_kernel.o sockopt.o pm_userspace.o fastopen.o sched.o \ mptcp_pm_gen.o obj-$(CONFIG_SYN_COOKIES) += syncookies.o
net/mptcp/pm_kernel.c renamed from net/mptcp/pm_netlink.c +20 -21
132 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/3 mptcp: pm: rename add_entry structure to add_addr
From: "Matthieu Baerts (NGI0)" <[email protected]>
[ Upstream commit 350d76dd6e79468ac85767f2d236299a135572df ]
Using only the 'add' prefix is confusing: does it refer to a generic added entry or address, or specifically to ADD_ADDRs. Using add_addr removes this confusion.
Stable backport adaptation for 2ac7d6e620764f1fc79eb4edd3610a7a661981ca:
The stable tree retains the ADD_ADDR announcement structure and helpers in pm_kernel.c, renamed from pm_netlink.c by the preceding dependency. Apply the structure-tag rename to those existing definitions and users instead of importing the upstream helper block into pm.c.
Update both return-type declarations in protocol.h: the announcement lookup is still externally visible on this branch. Preserve the stable function bodies, timer APIs, allocation APIs and linkage; no functions are added. The target's ID0 removal hunks apply unchanged to pm_kernel.c.
[ sashal: Reduced backport -- upstream 350d76dd6e794 touches 2 file(s), this
backport carries 2. Not backported here:
net/mptcp/pm.c
This note is generated from the file lists only; see the resolution record for the reasoning. ]
Stable-dep-of: 2ac7d6e62076 ("mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0")
--- net/mptcp/pm_kernel.c | 20 ++++++++++---------- net/mptcp/protocol.h | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-)
net/mptcp/pm_kernel.c +10 -10
@@ -18,7 +18,7 @@static int pm_nl_pernet_id; -struct mptcp_pm_add_entry { +struct mptcp_pm_add_addr {struct list_head list;struct mptcp_addr_info addr;u8 retrans_times;
@@ -253,11 +253,11 @@ bool mptcp_pm_nl_check_work_pending(struct mptcp_sock *msk)return true; } -struct mptcp_pm_add_entry * +struct mptcp_pm_add_addr *mptcp_lookup_anno_list_by_saddr (const struct mptcp_sock *msk,const struct mptcp_addr_info *addr) { -struct mptcp_pm_add_entry *entry; +struct mptcp_pm_add_addr *entry;lockdep_assert_held (&msk->pm.lock);
@@ -271,7 +271,7 @@ mptcp_lookup_anno_list_by_saddr(const struct mptcp_sock *msk,bool mptcp_pm_sport_in_anno_list (struct mptcp_sock *msk,const struct sock *sk) { -struct mptcp_pm_add_entry *entry; +struct mptcp_pm_add_addr *entry;struct mptcp_addr_info saddr;bool ret = false;
@@ -292,7 +292,7 @@ bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk)static void mptcp_pm_add_timer (struct timer_list *timer) { -struct mptcp_pm_add_entry *entry =from_timer (entry, timer, add_timer); +struct mptcp_pm_add_addr *entry =from_timer (entry, timer, add_timer);struct mptcp_sock *msk = entry->sock;struct sock *sk = (struct sock *)msk;unsigned int timeout =0 ;
@@ -353,11 +353,11 @@ static void mptcp_pm_add_timer(struct timer_list *timer)sock_put (sk); } -struct mptcp_pm_add_entry * +struct mptcp_pm_add_addr *mptcp_pm_del_add_timer (struct mptcp_sock *msk,const struct mptcp_addr_info *addr,bool check_id) { -struct mptcp_pm_add_entry *entry; +struct mptcp_pm_add_addr *entry;struct sock *sk = (struct sock *)msk;bool stop_timer = false;
@@ -390,7 +390,7 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,bool mptcp_pm_alloc_anno_list (struct mptcp_sock *msk,const struct mptcp_addr_info *addr) { -struct mptcp_pm_add_entry *add_entry =NULL ; +struct mptcp_pm_add_addr *add_entry =NULL ;struct sock *sk = (struct sock *)msk;struct net *net =sock_net (sk);unsigned int timeout;
@@ -431,7 +431,7 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk,void mptcp_pm_free_anno_list (struct mptcp_sock *msk) { -struct mptcp_pm_add_entry *entry, *tmp; +struct mptcp_pm_add_addr *entry, *tmp;struct sock *sk = (struct sock *)msk;LIST_HEAD (free_list);
@@ -1575,7 +1575,7 @@ int mptcp_pm_nl_add_addr_doit(struct sk_buff *skb, struct genl_info *info)static bool mptcp_pm_announced_remove (struct mptcp_sock *msk,const struct mptcp_addr_info *addr) { -struct mptcp_pm_add_entry *entry; +struct mptcp_pm_add_addr *entry; entry =mptcp_pm_del_add_timer (msk, addr, false);if (entry) {
net/mptcp/protocol.h +2 -2
@@ -1048,10 +1048,10 @@ bool mptcp_pm_alloc_anno_list(struct mptcp_sock *msk, const struct mptcp_addr_info *addr);void mptcp_pm_free_anno_list (struct mptcp_sock *msk);bool mptcp_pm_sport_in_anno_list (struct mptcp_sock *msk,const struct sock *sk); -struct mptcp_pm_add_entry * +struct mptcp_pm_add_addr *mptcp_pm_del_add_timer (struct mptcp_sock *msk,const struct mptcp_addr_info *addr,bool check_id); -struct mptcp_pm_add_entry * +struct mptcp_pm_add_addr *mptcp_lookup_anno_list_by_saddr (const struct mptcp_sock *msk,const struct mptcp_addr_info *addr);int mptcp_pm_set_flags (struct sk_buff *skb,struct genl_info *info);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/3 mptcp: pm: kernel: drop pending ADD_ADDR when removing ID0
In reply to Sasha LevinFrom: Kalpan Jani <[email protected]>
[ Upstream commit 2ac7d6e620764f1fc79eb4edd3610a7a661981ca ]
The in-kernel MPTCP path manager can leave a stale ADD_ADDR announcement entry alive when removing the id 0 endpoint. This happens because the id 0 removal path does not tear down pending announcements, unlike the non-zero id path.
When the PM later reselects id 0 after adding another signal endpoint, it finds the stale anno_list entry and hits WARN_ON_ONCE(mptcp_pm_is_kernel()) in mptcp_pm_announced_alloc().
Root cause: asymmetry between removal paths.
- Non-zero id path: mptcp_nl_remove_subflow_and_signal_addr() calls mptcp_pm_remove_announced() to clean up.
- Id 0 path: mptcp_nl_remove_id_zero_address() skips cleanup entirely.
Fix by making the id 0 path symmetric: call mptcp_pm_announced_remove() and decrement add_addr_signaled before queuing the RM_ADDR.
Subtle detail: signal endpoints are stored in anno_list with port 0, but msk_local carries the connection's local port. In other words, entries linked to ID0 paths should have port == 0. A follow-up patch will ensure that. mptcp_pm_announced_remove() uses use_port=true for comparison. So clear the port before the lookup.
--- net/mptcp/pm_kernel.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/mptcp/pm_kernel.c +8 -0
@@ -1677,6 +1677,8 @@ static int mptcp_nl_remove_id_zero_address(struct net *net,while ((msk =mptcp_token_iter_next (net, &s_slot, &s_num)) !=NULL ) {struct sock *sk = (struct sock *)msk;struct mptcp_addr_info msk_local; +struct mptcp_addr_info anno_addr; +bool announced;if (list_empty (&msk->conn_list) ||mptcp_pm_is_userspace (msk)) goto next;
@@ -1686,7 +1688,13 @@ static int mptcp_nl_remove_id_zero_address(struct net *net, goto next;lock_sock (sk); +/* Drop a possibly pending ADD_ADDR for this address. */ + anno_addr = msk_local; + anno_addr.port =0 ; + announced =mptcp_pm_announced_remove (msk, &anno_addr);spin_lock_bh (&msk->pm.lock); +if (announced) + msk->pm.add_addr_signaled--;mptcp_pm_remove_addr (msk, &list);mptcp_pm_rm_subflow (msk, &list);__mark_subflow_endp_available (msk,0 );
Signature · 1 line
2.53.0