FAILED: patch "[PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners" failed to apply to 6.1-stable tree
Subsystems (3)
Sasha Levin
maintainerThe patch below does not apply to the 6.1-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.1.y
git checkout FETCH_HEAD
git cherry-pick -x 49b09ae0bf57b4230187d4cdd0a370558e44a6e8
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 49b09ae0bf57b4230187d4cdd0a370558e44a6e8 Mon Sep 17 00:00:00 2001
From: Kyle Zeng <[email protected]>
Date: Thu, 29 Oct 2026 21:22:55 -0700
Subject: [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
mptcp_pm_nl_create_listen_socket() starts the TCP listener directly instead of going through mptcp_listen(). It consequently misses setting SOCK_RCU_FREE on the parent MPTCP socket.
tcp_child_process() can invoke the listener's subflow_data_ready() callback without holding the MPTCP parent lock or a reference to the parent. An authenticated MP_JOIN racing with endpoint teardown can therefore access the parent after its last reference has been dropped. The ADD_ADDR error path can also close an already published listener.
Set SOCK_RCU_FREE before __inet_listen_sk() publishes the TCP listener, matching mptcp_listen(). This protects the parent on every subsequent close path, including a failed endpoint addition.
--- net/mptcp/pm_kernel.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/pm_kernel.c +1 -0
@@ -906,6 +906,7 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk,* old status is known (TCP_CLOSE). */ inet_sk_state_store (newsk,TCP_LISTEN ); +sock_set_flag (newsk,SOCK_RCU_FREE );lock_sock (ssk);WRITE_ONCE (mptcp_subflow_ctx (ssk)->pm_listener, true); err =__inet_listen_sk (ssk, backlog);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 mptcp: pm: kernel: use RCU to free endpoint listeners
From: Kyle Zeng <[email protected]>
[ Upstream commit 49b09ae0bf57b4230187d4cdd0a370558e44a6e8 ]
mptcp_pm_nl_create_listen_socket() starts the TCP listener directly instead of going through mptcp_listen(). It consequently misses setting SOCK_RCU_FREE on the parent MPTCP socket.
tcp_child_process() can invoke the listener's subflow_data_ready() callback without holding the MPTCP parent lock or a reference to the parent. An authenticated MP_JOIN racing with endpoint teardown can therefore access the parent after its last reference has been dropped. The ADD_ADDR error path can also close an already published listener.
Set SOCK_RCU_FREE before __inet_listen_sk() publishes the TCP listener, matching mptcp_listen(). This protects the parent on every subsequent close path, including a failed endpoint addition.
--- net/mptcp/pm_netlink.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/pm_netlink.c +1 -0
@@ -1261,6 +1261,7 @@ static int mptcp_pm_nl_create_listen_socket(struct sock *sk, }inet_sk_state_store (newsk,TCP_LISTEN ); +sock_set_flag (newsk,SOCK_RCU_FREE );WRITE_ONCE (mptcp_subflow_ctx (ssock->sk)->pm_listener, true); err =kernel_listen (ssock, backlog);if (err) {
Signature · 1 line
2.53.0