Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept() time
@ 2026-05-06 11:20 Matthieu Baerts (NGI0)
  2026-05-09 12:46 ` [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept time Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Matthieu Baerts (NGI0) @ 2026-05-06 11:20 UTC (permalink / raw)
  To: stable, gregkh, sashal
  Cc: MPTCP Upstream, Gang Yan, Paolo Abeni, Matthieu Baerts (NGI0)

From: Gang Yan <yangang@kylinos.cn>

commit fcf04b14334641f4b0b8647824480935e9416d52 upstream.

On passive MPTCP connections, the msk sndbuf is not updated correctly.

The root cause is an order issue in the accept path:

- tcp_check_req() -> subflow_syn_recv_sock() -> mptcp_sk_clone_init()
  calls __mptcp_propagate_sndbuf() to copy the ssk sndbuf into msk

- Later, tcp_child_process() -> tcp_init_transfer() ->
  tcp_sndbuf_expand() grows the ssk sndbuf.

So __mptcp_propagate_sndbuf() runs before the ssk sndbuf has been
expanded and the msk ends up with a much smaller sndbuf than the
subflow:

  MPTCP: msk->sndbuf:20480, msk->first->sndbuf:2626560

Fix this by moving the __mptcp_propagate_sndbuf() call from
mptcp_sk_clone_init() -- the ssk sndbuf is not yet finalized there -- to
__mptcp_propagate_sndbuf() at accept() time, when the ssk sndbuf has
been fully expanded by tcp_sndbuf_expand().

Fixes: 8005184fd1ca ("mptcp: refactor sndbuf auto-tuning")
Cc: stable@vger.kernel.org
Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/602
Signed-off-by: Gang Yan <yangang@kylinos.cn>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Link: https://patch.msgid.link/20260420-net-mptcp-sync-sndbuf-accept-v1-1-e3523e3aeb44@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[ No conflicts, but move __mptcp_propagate_sndbuf() above the for-loop
  (mptcp_for_each_subflow()) present in this version, which will modify
  'subflow' used by __mptcp_propagate_sndbuf() in this new patch. ]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
 net/mptcp/protocol.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 09e1a93b7daa..c805d36fe50d 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -3428,7 +3428,6 @@ struct sock *mptcp_sk_clone_init(const struct sock *sk,
 	 * uses the correct data
 	 */
 	mptcp_copy_inaddrs(nsk, ssk);
-	__mptcp_propagate_sndbuf(nsk, ssk);
 
 	mptcp_rcv_space_init(msk, ssk);
 	msk->rcvq_space.time = mptcp_stamp();
@@ -4027,6 +4026,8 @@ static int mptcp_stream_accept(struct socket *sock, struct socket *newsock,
 		msk = mptcp_sk(newsk);
 		msk->in_accept_queue = 0;
 
+		__mptcp_propagate_sndbuf(newsk, mptcp_subflow_tcp_sock(subflow));
+
 		/* set ssk->sk_socket of accept()ed flows to mptcp socket.
 		 * This is needed so NOSPACE flag can be set from tcp stack.
 		 */
-- 
2.53.0


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

* Re: [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept time
  2026-05-06 11:20 [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept() time Matthieu Baerts (NGI0)
@ 2026-05-09 12:46 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-05-09 12:46 UTC (permalink / raw)
  To: stable, gregkh
  Cc: Sasha Levin, MPTCP Upstream, Gang Yan, Paolo Abeni,
	Matthieu Baerts (NGI0)

> [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept time

Queued for 6.18.y, thanks.

--
Sasha

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

end of thread, other threads:[~2026-05-09 12:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 11:20 [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept() time Matthieu Baerts (NGI0)
2026-05-09 12:46 ` [PATCH 6.18.y] mptcp: sync the msk->sndbuf at accept time Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox