* [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
@ 2026-10-30 4:22 Kyle Zeng
2026-10-30 4:29 ` netdev-bot+sinfo
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kyle Zeng @ 2026-10-30 4:22 UTC (permalink / raw)
To: mptcp
Cc: Matthieu Baerts, Mat Martineau, netdev, linux-kernel,
outbounddisclosures
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.
Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
---
I have a reproducer for this issue and can share via DM
net/mptcp/pm_kernel.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mptcp/pm_kernel.c b/net/mptcp/pm_kernel.c
index 1a7750813235..f7396628490e 100644
--- a/net/mptcp/pm_kernel.c
+++ b/net/mptcp/pm_kernel.c
@@ -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);
base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3
--
2.56.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
2026-10-30 4:22 [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners Kyle Zeng
@ 2026-10-30 4:29 ` netdev-bot+sinfo
2026-10-30 6:16 ` MPTCP CI
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: netdev-bot+sinfo @ 2026-10-30 4:29 UTC (permalink / raw)
To: Kyle Zeng
Cc: mptcp, Matthieu Baerts, Mat Martineau, netdev, linux-kernel,
outbounddisclosures
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account. If the series needs another revision for
other reasons, please include the information in the commit messages
then.
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
2026-10-30 4:22 [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners Kyle Zeng
2026-10-30 4:29 ` netdev-bot+sinfo
@ 2026-10-30 6:16 ` MPTCP CI
2026-11-02 18:07 ` Matthieu Baerts
2026-11-05 14:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: MPTCP CI @ 2026-10-30 6:16 UTC (permalink / raw)
To: Kyle Zeng; +Cc: mptcp
Hi Kyle,
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): Success! ✅
- KVM Validation: debug (only selftest_mptcp_join): Success! ✅
- KVM Validation: btf-normal (only bpftest_all): Success! ✅
- KVM Validation: btf-debug (only bpftest_all): Success! ✅
- Perf: Success! ✅
- Task: https://github.com/multipath-tcp/mptcp_net-next/actions/runs/41004800864
Initiator: Patchew Applier
Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/e7fe1385ce91
Patchwork: https://patchwork.kernel.org/project/mptcp/list/?series=1196811
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)
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
2026-10-30 4:22 [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners Kyle Zeng
2026-10-30 4:29 ` netdev-bot+sinfo
2026-10-30 6:16 ` MPTCP CI
@ 2026-11-02 18:07 ` Matthieu Baerts
2026-11-05 14:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts @ 2026-11-02 18:07 UTC (permalink / raw)
To: Kyle Zeng; +Cc: mptcp, Mat Martineau, netdev, linux-kernel, outbounddisclosures
Hi Kyle,
On 30/10/2026 05:22, Kyle Zeng wrote:
> 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.
Thank you for the fix, it looks good to me!
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
@Net maintainers: this patch can be applied in -net directly.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners
2026-10-30 4:22 [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners Kyle Zeng
` (2 preceding siblings ...)
2026-11-02 18:07 ` Matthieu Baerts
@ 2026-11-05 14:10 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-05 14:10 UTC (permalink / raw)
To: Kyle Zeng
Cc: mptcp, matttbe, martineau, netdev, linux-kernel,
outbounddisclosures
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Thu, 29 Oct 2026 21:22:55 -0700 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- mptcp: pm: kernel: use RCU to free endpoint listeners
https://git.kernel.org/netdev/net/c/49b09ae0bf57
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-05 14:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-30 4:22 [PATCH] mptcp: pm: kernel: use RCU to free endpoint listeners Kyle Zeng
2026-10-30 4:29 ` netdev-bot+sinfo
2026-10-30 6:16 ` MPTCP CI
2026-11-02 18:07 ` Matthieu Baerts
2026-11-05 14:10 ` patchwork-bot+netdevbpf
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.