From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866930; b=ZBTa2aOzENuvUDdo2y9YCANN1d3Zxw7hjclePo6hSLOWBydEadRZoHpDzZ2myiw2ghbc abqaDeJwsJ48iJpb5HAOijQNwtRrfoPmB8OayqdKINy2e+lbuBJoQjxTFVsED45K6i2dc rWFqKuvjgF3xR0/cQao2uZhuat4wrOPdyAj0J5Xh/dBF2ABlVU8CbSGPIGBcdDwRcWyNN sIXqItxeNUABi2r6Hp0Mxu7iKW5IVpKDqcQmUHgKg/F316KLRV0mCDwZeVokoycKANkoV iJwXEob9Qb/Q9C6kzGObFr04G98vYSDa4pMP0ZcowLGY02uKWAVp8Vkr1QujrJZw7qA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866930; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=uMYq6JE8xuNZqyVh9m0VgbWr7vZYU9GSmfyKxFS5D+A=; b=1Bb74MJsS8T7VPi33zKfdUsTD4eeEe/cU3c5FfJZyXAppyywOD156cCfsvZOc8rPBy2U VZNaTkV3X6HdGR25wb6bhp3ohFHB3+TaAN1awXcOdydWjQnPlZfosaTRVi/HGGcFxRrht b97eLstj9zcTY4nk5Y+X/2c8kGLVanDJiDcaE7YgBC3EI24o9TxH7bslGQ4t+tezvZAYM PoPSzdoZGvdtvGsIqKoP4fK0AGpD56Dpl9kV8HqxnIJtqFXZ9GTUTRcbA4pxXgRZMB9ZV genZ30XYpQO8J0JDac9lhx20z0msp+RtGrFzhCp5l3IVL/FDXLTZwas56EZJaOOAYnA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DLidWKMH; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 773A6606A330; Mon, 16 Nov 2026 22:08:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DLidWKMH Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA7BA1F000C4; Mon, 16 Nov 2026 22:08:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866930; bh=uMYq6JE8xuNZqyVh9m0VgbWr7vZYU9GSmfyKxFS5D+A=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=DLidWKMHgkte+wcx8XviGctfDknmqXQhV6a00gH3EIHqU7Afe13izKrBMzLE+ahf6 SHtdWjtSQGVabAvD+hROIl3Z1XeYFgI8CZ/B2+ZIYcitEPqOIUJsdv5PgGY1Gek+OP KzBi5m2FWAoHqC+q+Xg8PZIDQYRzyV4tSA8lwRAt3jfAcd20LZhq0XHAM4fs+EoiTt mUFOrjYuMshD/iMSmvXxQtCMk/y4DCDWIy1oIu2FrWHpcu2W11ZYI+yeJ7Vf+JqzdE t6jFyXF6WTGmDDqXQmwqHz67UIp/6BmkRUB5gDmIjuzRtlNaXTT2ZTlhE9acaRpSSe wZ/q+ng1XXUdw== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:08 +0100 Subject: [PATCH net 1/7] mptcp: do not use a raised snd_wnd for the send window X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-1-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3711; i=matttbe@kernel.org; h=from:subject:message-id; bh=7zDQSYKcpnKhli3dcbyFsT9TAjx17AqSPorjk+qb/hU=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+1z2bodi3o0M+f3vSn0sBImwn/iz4FNWxe9NV0U2PP iQeZGiX7yhlYRDjYpAVU2SRbovMn/m8irfEy88CZg4rE8gQBi5OAZjInY+MDCff+5y5OeHnv7yd x9JPXfq3/9bpx9eXbbEItUjeWN//79oXhv9ufTeVH62qmh948c+K8mPq8xym/kxg7HytLaUa5ls 3/yc3AA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 ack_update_msk() sets the right edge of the MPTCP send window from the DATA_ACK and tcp_sk(ssk)->snd_wnd, but this is not always what the peer announced: mptcp_check_allowed_size() raises it to window_end - data_seq, so that TCP lets through what the MPTCP-level window allows. That is fine for new data. For data sent again, data_seq can be below snd_una, and snd_wnd ends up too large by the difference. TCP only overwrites it when an ACK moves things forward on this subflow, see tcp_may_update_window(). If a DATA_ACK moved by another subflow comes in on this subflow before that, wnd_end goes past what the peer offered. It only moves forward, so it stays there. The sender then transmits data beyond the peer's window: the peer drops it (MPTCP_MIB_NODSSWINDOW) after TCP acked it, and only an MPTCP-level retransmission can recover it, which raises snd_wnd again. The connection can then stay stuck at a low rate for several seconds, with nothing in flight on any subflow. This raise has been added by commit b713d0067574 ("mptcp: really share subflow snd_wnd"), but snd_wnd could already be too large before: when nothing moves at the TCP level, tcp_may_update_window() ignores a lower non-zero window, while the peer can announce one with a DATA_ACK that moved, keeping the same right edge. Use the window announced in the packet carrying the DATA_ACK instead. In my case with BBR, a small TCP rmem, and a second path with a much higher latency, a lower throughput and some losses, this small change can double the throughput in the worst cases. The issue has been reproduced with a new Packetdrill test, on a single subflow: the data is acked by TCP, then by MPTCP with a lower window, keeping the same right edge. Without this patch, the 2000 bytes written next were sent, instead of the 1280 bytes up to this right edge: dss_dack_window_server.pkt:23: error handling packet: live packet payload= : expected 1280 bytes vs actual 2000 bytes Fixes: 6f8a612a33e4 ("mptcp: keep track of advertised windows right edge") Cc: stable@vger.kernel.org Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 02e785a14b8a..a1e65309171e 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1120,9 +1120,11 @@ static void rwin_update(struct mptcp_sock *msk, stru= ct sock *ssk, =20 static void ack_update_msk(struct mptcp_sock *msk, struct sock *ssk, + const struct sk_buff *skb, struct mptcp_options_received *mp_opt) { u64 new_wnd_end, new_snd_una, old_snd_una; + u32 win =3D ntohs(tcp_hdr(skb)->window); struct sock *sk =3D (struct sock *)msk; u64 snd_nxt; =20 @@ -1143,7 +1145,12 @@ static void ack_update_msk(struct mptcp_sock *msk, after64(new_snd_una, snd_nxt))) new_snd_una =3D old_snd_una; =20 - new_wnd_end =3D new_snd_una + tcp_sk(ssk)->snd_wnd; + /* What the peer announced: tcp_sk(ssk)->snd_wnd can be larger, see + * mptcp_check_allowed_size(), and is not always updated. + */ + if (likely(!tcp_hdr(skb)->syn)) + win <<=3D tcp_sk(ssk)->rx_opt.snd_wscale; + new_wnd_end =3D new_snd_una + win; =20 if (after64(new_wnd_end, msk->wnd_end)) WRITE_ONCE(msk->wnd_end, new_wnd_end); @@ -1313,7 +1320,7 @@ bool mptcp_incoming_options(struct sock *sk, struct s= k_buff *skb) * monodirectional flows will stuck */ if (mp_opt.use_ack) - ack_update_msk(msk, sk, &mp_opt); + ack_update_msk(msk, sk, skb, &mp_opt); rwin_update(msk, sk, skb); =20 /* Zero-data-length packets are dropped by the caller and not --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866933; b=VUsKr1+p6/Dmy/PPXUowfJRd4/deR4qgpVPUYnnrwUCKoTowaY7yFlAMoYiOA2iH7i0n /X3l0oPs7ejOgsyUMI61+eRRIpI0kAKeEVGIdrY4Sn4lBBKbO8cmgVgauO2+1ZB0+pTBq vmgurGoe53nfBLyihDnPmixTYKNky2Xq42Pm9BDkdD9lIcksJhH4k1kPHm1vI62SqN2zo 1l2L7QT0RakRHdRfaqy6lYDya1jXWgwhUWPay9r8vkvQDwe3K07HRSMmCbmbeKs9s1Yqg h8kIsPXvYqbeC3RELFpTeg43I9luRiP8gInD8OB4ozA6fywTIKMY0tp7CDuMqCartiw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866933; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=fASJVZS6eae9LxRGOU8UXTUuLY6ysPWMoGJyRiEOZic=; b=NX1VddIGftNBF4CoDYo5Eusiq2XPmgHkeGjQPjHJZL/2RBYgbbtD18HPOBGdfZduUoRx w55zOrZiJFU0Tb70w67i4s1nKMrbMxfo1aqrqTnUxMvMlOAKKRJe4YodGT5BlMQj+zaSy wBICqG1FSjxyjIq+XjLHfbY33r6WFkGAfed5FUWlBhu4lyaouQ5+K8yyUsR3RsrRTageb Kvy9CO5zIHXYrmdCvhCeMK7tYtovzAKitdtP7qu5GE7IVfaBXzW9c3gcQaQ4MR2H00QMH nox8L5TOnzvH8DQR4QkZ5PShOjWswzxdNo1tzbq/prPGZ7FBV1JFE5wdUB+g9EaiVew== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CdHzTetm; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ACB660A2611; Mon, 16 Nov 2026 22:08:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=CdHzTetm Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BCD61F000C5; Mon, 16 Nov 2026 22:08:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866932; bh=fASJVZS6eae9LxRGOU8UXTUuLY6ysPWMoGJyRiEOZic=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=CdHzTetmXjvIW8qs4EVDVmVG1L1/YPkaKGG0pMK9+A71bd7ABaBGMD/70Kh1ZgcjF 0oyAFVHZoftAdWEZ4Y0SXyc732qSDx8TGxst2IYoK6yg5iGMth5G/E914nod2dL6U9 zM1HrXHnJ6dZktsvX68n9sTNlcLv9Q5ttOYVMTpiVkhjqXPc/zzbX092JSCl5BtlIS CNOMeWAJBvRPNzpN5q5q5CU3Bd7QBTcMvHZnEGwzFnIhu9ve2zfwVhmM190kcU7NGL /kuV78xrpGJOGvExGOFAPkCriPumEaQX2VSL7Ev9zeAYvxj4bGMWdYO9qV8o9lPkjg riHAfybjO8HdA== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:09 +0100 Subject: [PATCH net 2/7] mptcp: push pending data after a sendmsg copy fault X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-2-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , Quanye Yang , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1670; i=matttbe@kernel.org; h=from:subject:message-id; bh=306+4uW4TpE7s0K8Pmzi6N99z+xxvTfHEkxIyFliHBs=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+1z3TEZUzmZ025YbSqe9leQcnZbQ0iB5U2rnzSae44 czvagHRHaUsDGJcDLJiiizSbZH5M59X8ZZ4+VnAzGFlAhnCwMUpABO5V8LIsKuF/adz9akHs4sl 8y6lhj+Zrlp/Z4rF+ys1H/J37phq4MfI0Nx09Lk+d/b094a36usF9rmlsftN2Nz3Z2fE7e3XdD0 3sQAA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Quanye Yang mptcp_sendmsg() copies into the msk write queue first, then __mptcp_push_pending() on the success path. tcp_sendmsg_locked() does the opposite: its do_error path jumps to out, and out calls tcp_push() when copied > 0. A later iovec fault (copy_from_iter / -EFAULT) after a successful iteration therefore returns the partial byte count but leaves the already-queued dfrag on rtx_queue. No subflow packet is sent, no retransmission timer is armed, and DATA_FIN stays blocked on first_pending. Push in do_error when copied is already non-zero. Do not move the push to out: copied is a size_t, and sk_stream_error() stores a negative errno there. The issue was spot by Sashiko, but easy to reproduce with Packetdrill: writev(4, [{..., 32728}, {NULL, 4096}], 2) =3D 32728 Fixes: 69800e516e96 ("mptcp: propagate fastclose error") Cc: stable@vger.kernel.org Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/640 Signed-off-by: Quanye Yang Reviewed-by: Matthieu Baerts (NGI0) Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c index 8968db58083e..b67096ee131b 100644 --- a/net/mptcp/protocol.c +++ b/net/mptcp/protocol.c @@ -2130,8 +2130,10 @@ static int mptcp_sendmsg(struct sock *sk, struct msg= hdr *msg, size_t len) return copied; =20 do_error: - if (copied) + if (copied) { + __mptcp_push_pending(sk, msg->msg_flags); goto out; + } =20 copied =3D sk_stream_error(sk, msg->msg_flags, ret); goto out; --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866936; b=gAQjedInxhY7zLrzObvboUxavZ3ZB+TH9m2242KPX06aHe7kXAs2OH6YPpMsn8w5BaOt WglmY1kzTHcYReoYC843hYHBcegPWjGOJBbjEhptDr9ZsjOxIl08F5TxVf4JZeHP7QS2q cTBK9ngWShdR7PgzVjp/90ZpEUxXJ2vX+exrpvucGNMIgD/GhrK3VzeVRVsRGFyLJ7C4b mQAbYYbIgLI2mYAmKYKb904VTB5+w3U+9gnjWu5/umN0Kn9t70r8XBXPreFXg9I/jj8zH vcwTMl6/ltcJKcEXO9fnM2tM3OQ45btLIYm8G1BbxOa/mPsc2Dc0CaPiYFqcNdBfbrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866936; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=Tj2/cFIwMQiU0oTdy1lbkijRfjf34Z7e24OcuJwQONY=; b=xyaKL7uNFZ0Otwj0zdXSPQXmjkRtSlW03hDDcL2hpzvfoOLzHmn+8Bdcb+O1VsadjyiU cEpw4+hRypdy+vuAeSAVi4smLqW8+xCpapAFHGTVEAaKzNgZAngUfNpi7aBY1/krunRdM N1o3PMQydmiS3Zvyyx1PNFrgNhaRot2pLgHPef/UMrzQcq0Y3gggadNyX9SsG6SUOF6F9 apAxYf+UFJ6dl55xqIJHTMRI3NY+7dvyoBOJf7xIw6GopQ6Jf38qGRRYEmkJgvdTFTHNx YclyQ1YfKG1FjJsLWF+dJOba8Qzas4hYO1Evq3beqa44896yx3OjwCWqo+Mnxu2cxBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=S2QqxXbK; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 127D160A262C; Mon, 16 Nov 2026 22:08:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=S2QqxXbK Received: by smtp.kernel.org (Postfix) with ESMTPSA id 528D01F000C6; Mon, 16 Nov 2026 22:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866935; bh=Tj2/cFIwMQiU0oTdy1lbkijRfjf34Z7e24OcuJwQONY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=S2QqxXbKe3sufn9poQhFXU+WJWVCh02pWq02vwmIQE05eLt1F4Vwr598L+IcJjXCU S3G9NdVNUhFT5+hRNd4wuZ3/J59ExXMHRrgssn10qAvpSjCPocX+vg+ouvrMb+eE/p WpqF8gMQF53r0CpFMdwAOZHGv3twWC116J+A+UBhDdV5EUr/7wnnCtXOW5XD3b4vgH XhMmm+cRDu+LpEHUVM6ksGHxX3a+yA3vucCOKOQtySyrYDPSp6jItAuX56Cn8y31U7 nFzHxWsJYU1co4DTSmg+WrAoTxKZlgq/jmRqJEKBPDxMjzVsYWHC+DoVH684az4tUu Y5UUa6gqQULsQ== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:10 +0100 Subject: [PATCH net 3/7] mptcp: use sk instead of casting msk in check_fully_established() X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-3-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1620; i=matttbe@kernel.org; h=from:subject:message-id; bh=QwxgCSzbTvt4gHjKMplH154tKIyEr+lvY7q4aegDmF0=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+1z23fnLld3ls6skXL7+sFC46P///4rz3G2oOPHviz bKWd2bNkY5SFgYxLgZZMUUW6bbI/JnPq3hLvPwsYOawMoEMYeDiFICJLF7AyPDPRH6F46Y01aYF RzRnm5VtPMz1dtvUDfU+F/Xam6Rn39Nl+MU89d+MzgdM/0z7jn5e+3zB2buXnU7Nf1NetICF40V GQiMrAA== X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 The MPTCP socket is cast to a struct sock in check_fully_established(), to take its data lock. The next commits need it more, to push the pending data. Add a local 'sk' variable instead of casting msk each time: no functional change. The 'Fixes' tag here below is the same as the one from the next commits: this patch is needed to fix the issues introduced by this commit ID. Fixes: 36b122baf6a8 ("mptcp: add subflow_v(4,6)_send_synack()") Cc: stable@vger.kernel.org Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index a1e65309171e..1c58468b985b 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -982,6 +982,8 @@ static bool check_fully_established(struct mptcp_sock *= msk, struct sock *ssk, struct sk_buff *skb, struct mptcp_options_received *mp_opt) { + struct sock *sk =3D (struct sock *)msk; + /* here we can process OoO, in-window pkts, only in-sequence 4th ack * will make the subflow fully established */ @@ -1043,9 +1045,9 @@ static bool check_fully_established(struct mptcp_sock= *msk, struct sock *ssk, if (mp_opt->deny_join_id0) WRITE_ONCE(msk->pm.remote_deny_join_id0, true); =20 - mptcp_data_lock((struct sock *)msk); + mptcp_data_lock(sk); __mptcp_subflow_fully_established(msk, subflow, mp_opt); - mptcp_data_unlock((struct sock *)msk); + mptcp_data_unlock(sk); =20 check_notify: /* if the subflow is not already linked into the conn_list, we can't --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866939; b=DDxo954dcmlOnphyFq1XFcglCoCH+fx5yW0jipSZ1AOPz9jbRnrrFDL9UqaAAjyzGe7K RroJXkvRzBaKo3JT4+IAfAPzQVqzi1ae2JqbeVXl+wN9ckRXr1GZWYX/VMm6Awm9gGHct egFFtvUK0IwVNZg/rj+FUm7+ILCLQryZdi2YeCda5TFxLuL4PSIJ2Zo+sX/pivT1C4NGh BwuQO6QgZMVx5djO4OUf918hkFEmt1fJ0XfCx3aketUYornXHHSi1KegoPmIxtpKHMpw9 SPBdNfXpwHqJwssFZT6YHtt3qv8ais6K658NTsd4vd0XYSWxYN6awJoGxJq1aFl20NQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866939; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=XqaW+Qhx8VDnAfYz2JghfbB6/NHBkgGqjkXI2iJsQaw=; b=PjRZYiL5xd0wZ3aeDQCZSF+61YPF/Dn7C3uLdqUfDssWOGOmCaJryZm2mTipXFKDChbW AAO635bkTwWmj3eIKgfwwf2fEnStvz3gKPvcVyo5TbRvoneNtV0/B5cS1nfAJXjrAXqKK 1frmoDr5onDq/6KnA14OIDRNtOo+1UWy84U0igC/wzLxwgs8y3yXeNJROuQDadDa4fFvT lwntin/lAaN42OeHlOWfZ0Z2/NwliexkZsnM1ili9ewLi8NSw5ZAX1T2GCiMsgW8p0kN2 asHCNBWYFAdhVizZXg45FuNzfyHdI9jvEAxwAj2S0u0Qk68xA5c7grUrXOu2T6RHzow== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V6RZv3rz; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED7D9606A898; Mon, 16 Nov 2026 22:08:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=V6RZv3rz Received: by smtp.kernel.org (Postfix) with ESMTPSA id 036AB1F000C4; Mon, 16 Nov 2026 22:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866938; bh=XqaW+Qhx8VDnAfYz2JghfbB6/NHBkgGqjkXI2iJsQaw=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=V6RZv3rzfI9+SBVg+revsPO6JStwynq3VsxgmT4Pw47vOj0SuUDiS74oS00zM/qSb wfsGlXcJ91T8XSKQMri9HCZrkxZ99CBSpbI9HNm0M4+brQ3ciAh1v61yRThaWrUW88 kiTWkyQRLSfZVVAshK/4aseJ1/ZhqdB76UQii7VJhkKvC0quBI0+TOL/boEjnyVCiu 5OTxSNXmQxXe63PRRuPIRLnpTbplOdmFOQfycAr5yIgKHOmb7sugjZo2hISQtiOvkI a+DIZ3Hhqwn1iabx0hZuxvatAqat/zV+tu2+tbzqo7DWELgmTw00HzNs31tBr5hjSb 87gqmgWmF+6aA== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:11 +0100 Subject: [PATCH net 4/7] mptcp: push queued data on passive TFO subflows becoming established X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-4-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Petar Sakic , T S Rameshkumar X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3059; i=matttbe@kernel.org; h=from:subject:message-id; bh=d/ZZTVBXnUn2aIb2rzqSvZ8PZ3bEm+rqCAf6ZVsqk2g=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+173oa17MvcekNbtcp++8RyWb3bf3Cwp/+VyZ8jXGw fLfzT+XOkpZGMS4GGTFFFmk2yLzZz6v4i3x8rOAmcPKBDKEgYtTACYiYMHwT83pfsP247cS1CYG /t133Fv88G2eBOfImSaed+v6M/u+fWRkWOxvXrElc0HnnhqJxRXNjSoc4Xu05TsZzfVqn39N4Xb jBgA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 With TCP Fast Open, the data written by an MPTCP server before the 3rd ACK is not sent when this ACK arrives, but only when another event triggers a push, e.g. new data from the peer. With a request/response protocol, the client waits for the reply, which can then stay stuck. A SYN with a valid TFO cookie creates a child socket right away, which can be accepted while its subflow is still in the SYN_RECV state. The MPTCP socket is already in the ESTABLISHED state: send() puts the data in its write queue, but this data cannot be pushed to the subflow before it is established, see __mptcp_subflow_active(). When the third ACK, with the MP_CAPABLE option, arrives, check_fully_established() marks the subflow as fully established, but nothing pushes the pending data: this ACK has no DSS option, so ack_update_msk() is not called. The fix used here is to push the pending data when a passive TFO subflow becomes fully established. Checking subflow->is_mptfo is not enough: since commit e00b63056fb4 ("mptcp: fastopen: only mark MPTFO subflows with SYN data"), it is not set when the SYN has no data, while a child is also created in this case. syn_fastopen_child is then used instead. This issue has been reported by a user of proxies over MPTCP: the clients put their requests in the SYN, and the replies from the targets close to the server were stuck. It has been reproduced with new Packetdrill tests, where the server writes data before the third ACK, after a SYN with and without data. Without this patch, and before the earlier commit "mptcp: arm the rtx timer if a push leaves data behind", this data was not sent: server-tfo-write-before-3rd-ack.pkt:24: error handling packet: Timed out = waiting for packet Since this earlier commit, this data is sent, but only when the MPTCP retransmission timer fires, here after one second, as the tests increase its interval: server-tfo-write-before-3rd-ack.pkt:24: error handling packet: timing err= or: expected outbound packet at 0.237174 sec but happened at 1.181857 sec; = tolerance 0.100000 sec Fixes: 36b122baf6a8 ("mptcp: add subflow_v(4,6)_send_synack()") Cc: stable@vger.kernel.org Suggested-by: Petar Sakic Suggested-by: T S Rameshkumar Reported-by: Petar Sakic Closes: https://lore.kernel.org/mptcp/CAFPPu1gU2Y-D+d4i3F0MoNkYK+e1U+=3DX3q= f6QycjfKBw+8snPg@mail.gmail.com/ Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index 1c58468b985b..bcf3440d1901 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1047,6 +1047,8 @@ static bool check_fully_established(struct mptcp_sock= *msk, struct sock *ssk, =20 mptcp_data_lock(sk); __mptcp_subflow_fully_established(msk, subflow, mp_opt); + if (tcp_sk(ssk)->syn_fastopen_child) + __mptcp_check_push(sk, ssk); mptcp_data_unlock(sk); =20 check_notify: --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866941; b=K6kVO5PHTuF/7iIjNwlkeu9Sngp4kqbjND7gkPHp4WJKxiUeOPVLO2Uy+W42vxWMMGJ9 SMVZeD4KyDOXf+AYh13FxxzscZDoBj5T+ga6t14YsIRUTyYjTWImPdjqYuAJ4HBgiB2PY 9v1h/jrgvnU8pYk1Uj30bVivtK2uMnz0A9x6B8Kp2TUMazfEwtjuoAO7st7l9zc9hCqyz woHPf5jsYoHFY7YRPVs6fS8kwOuTt2JVgfNItUHciWNQ/S7nhdXkOgL4VyqI+IaGG0Ccb mQQ1lMKtHoFCC2Mu99pWsbAkpz+PeYt3KJSVFyiKcm9WJB3CbqLYbF0mb4wtetBOXHA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866941; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=XeFi5cCNjQ75ncJcr9kVqUiYUHdBVb+5baL45/OqCQM=; b=KejOOaa/s6nzTQZPsNMQ74X3UHLWMrnZkWrVJLtn0px5hKxL1O5KyJuQyILZMQhE6Gde GTY8i6ar+0oQ9shrgnljok8QzAijEAwnCIsq/1Aw7m4Kw6Hg/H3TXUDA4GGMN7m7QhY4R 9rhNb41P2BURujzzu54FUDQHGxQAmf34+sykg+Ree36O/70fL0XxHIdeVcWrr31ygT0sI 44eDAN1cPKN55wO0C7vsLpqtpykVSZEaOjAG1xOMpyFFUMU2EJRqpzjTjedkSqDGc4I7D drVQc1+KAD/AYaJ8kLz7XspRshSdGyvcNzgO9CfC3ehhoRy6gFSta0A5hIf12G2uOZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="LFaGbaB/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68A74606A332; Mon, 16 Nov 2026 22:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LFaGbaB/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02F791F000D2; Mon, 16 Nov 2026 22:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866941; bh=XeFi5cCNjQ75ncJcr9kVqUiYUHdBVb+5baL45/OqCQM=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=LFaGbaB/5yuL0F57HTHlahpbnmd2QMFDWhqRTJfYgGxgvbV+DbF54DHK1mTz1as5R FQvdzBsSUTl+Ejd89z+9PqUtWsOx20Hpn03fYpqMH4oi06vz5u3z7bqcKOxlBLZbVt lqYuLujbOYTy29hK3hsMePSTBFOA+Ab6LqBJM5O8+6MLpmYBaXW5jpplVwF/cooH+F LwdMgvAgaUsKLaktxhIyUnpwJQrftB1Lwv4sngaxVXKleb7MyMNyom/MpYzFoMv09I 6Vvc+Xb35PZbmAspXQ61s2lDwa9FjdNKlBDAd9w3Yq3atrykcKFbMSzZOqyA17IpyQ 12XSf3mhNTz9A== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:12 +0100 Subject: [PATCH net 5/7] mptcp: push queued data on subflows falling back at the handshake X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-5-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3208; i=matttbe@kernel.org; h=from:subject:message-id; bh=bBQ+7q7jKXtl+hia6u5vrQe80TFZSnB3h5CQQ2i9hd8=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+173Y/NbQ8TZHM5elrKuC+gSp7TUh7yYw8m2e6a5+f otog9WMjlIWBjEuBlkxRRbptsj8mc+reEu8/Cxg5rAygQxh4OIUgIl8lGBk2FvmVnshfE/29W9c iVIbtf+xPg2fkSh0uGeB7pWGxZfNyhh+MVtveMYy+8Fn4c4LPgLX/r+3+f/M/2DT3LWFU3OObBI R5QEA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 With TCP Fast Open, the data written by an MPTCP server before the 3rd ACK is not sent when this ACK arrives without MPTCP options, but only when another event triggers a push, e.g. new data from the peer. The previous commit pushes this data when the third ACK, with the MP_CAPABLE option, makes a passive TFO subflow fully established. If this ACK has no MPTCP options, e.g. because a middlebox removed them, check_fully_established() falls back to TCP, and returns before this push. The fallback case of mptcp_incoming_options(), which pushes the pending data, is only reached with the next packets. The fix used here is to push the pending data after this fallback too. Not only for the passive TFO subflows: data can also be pending on the client side, when the first ACK from the server has no MPTCP options, e.g. if the window announced by the SYN+ACK was too small for it. Same here, this data was then only sent when another event triggered a push. This issue has been found by an AI code review agent (Clashiko), while reviewing an earlier version of the previous commit. It has been reproduced with a new Packetdrill test, where the MPTCP options are removed from the third ACK. Without this patch, and before the earlier commit "mptcp: arm the rtx timer if a push leaves data behind", this data was not sent: server-tfo-fallback-write-before-3rd-ack.pkt:26: error handling packet: T= imed out waiting for packet Since this earlier commit, this data is sent, but only when the MPTCP retransmission timer fires, here after one second, as the test increases its interval: server-tfo-fallback-write-before-3rd-ack.pkt:26: error handling packet: t= iming error: expected outbound packet at 0.235869 sec but happened at 1.144= 189 sec; tolerance 0.100000 sec The client side case has been reported by Sashiko, while reviewing an earlier version of this commit, and confirmed with another new Packetdrill test, where the client writes more data than the window of the SYN+ACK, before an ACK without MPTCP options. Without this patch: v1_connect_fallback_pending_data.pkt:30: error handling packet: timing er= ror: expected outbound packet at 0.251394 sec but happened at 1.195904 sec;= tolerance 0.100000 sec Two Fixes tags: the passive TFO case comes from the first commit, and the client side one from the second one. Fixes: 36b122baf6a8 ("mptcp: add subflow_v(4,6)_send_synack()") Fixes: 6f8a612a33e4 ("mptcp: keep track of advertised windows right edge") Cc: stable@vger.kernel.org Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/options.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/mptcp/options.c b/net/mptcp/options.c index bcf3440d1901..617358ff7f99 100644 --- a/net/mptcp/options.c +++ b/net/mptcp/options.c @@ -1035,6 +1035,10 @@ static bool check_fully_established(struct mptcp_soc= k *msk, struct sock *ssk, MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_FALLBACKFAILED); goto reset; } + /* this ACK will not reach the fallback path: push from here */ + mptcp_data_lock(sk); + __mptcp_check_push(sk, ssk); + mptcp_data_unlock(sk); return false; } =20 --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866944; b=4zOvreMmBvfFUuH/YWIlJkDbkixZH4LoMjB3IMTr2Wv4FzVh9JEr0T3OtwX0Ae+649/A M6HCBo7hmDAGEb5dVgPk/N8U6z4zSW50SgBh5Er97XwaUNaO39KtILIJZA7A+k2jIeF98 63dF1KbYR8BW1pRzMGO5M819SXW5/qDT6r9pVTryDCALqD7ltp3xFYHAWRU8UtHZJM8Y/ 7JURQS6rG+68Rq4bmiMyC6acBL+pLE4d38AjqLz+IxnA13+OuB6PlT9eUdMys9XXPRkkF 3KpaiglcDO9lj9ZIqqw4H79cB3hWT+V1ir61e8C1KASjEUOpCQDuL8ywYW0F9MF2uYQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866944; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=7mgC9jL8NBJ5pYS7EFVo2spVfEdDqKdaGi7rc+pAARY=; b=VZzdT1ToLGI25HhxhNQ5pkR7na1oPdT6iC/30dfWJFHDS5uMtuQslU40qpuSlQRLW6vd 7TyqEgQWxKNfFWoY01aCqQFTTk64WxI5Y9ZtNgH9AZczf+RKuhJ4rC47QTEFc8tfit97n GpBYhcppM3yrBvSfLaeCX55u9DmGLd2RrBliNGt1LqJU0gJe0uahCLZjKgJiedId3gxch 02VeU7ZfSHpuh20NTZrDyzclQOEHDmPEpEDaUGkCnXr+fJsGL5alhQJz0jQOhLFJBJ5wJ BLcUpc1wbPMt7b1o+6uKefzz8NJbxVmjOHGfhA/YIPx986/l0kCl+vbIZ+Xpgac60Lw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hetkCGdD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DF6A606A8B9; Mon, 16 Nov 2026 22:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hetkCGdD Received: by smtp.kernel.org (Postfix) with ESMTPSA id A74BB1F000C4; Mon, 16 Nov 2026 22:09:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866944; bh=7mgC9jL8NBJ5pYS7EFVo2spVfEdDqKdaGi7rc+pAARY=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=hetkCGdDXEkm2883ua7V0ixFQK5QSPIpIaWy78Hd4Iwo4hmZDI2Yoloe5w/YmIqVf XudrZ0hzES6OovQtMHnR9psf+FQ4VmEcUuTT4kIC50ZOw9xyzhGD3OP8xFxYsKClGC Qz9blZXLb3/YEk0lCBL6Hgln6WNh2Ht/j0zU9QsqXHaJ0Pi2t+muHZXwidOqJhEwUP +Y5WANWD9vvclNWiNdgabAGpmYozJYPT+AXeryQ7528KsP2um0jSFpKuf9oXG4mY6D VCAzzm7+c9qlVcHN0AVBuqCGPYRB8/HYWqLbF3eAevaV9j1EkiaHLl5/hf7CEsaPnp Ns37YVyfZ7XYA== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:13 +0100 Subject: [PATCH net 6/7] mptcp: don't send a FIN before the pending data on fallback X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-6-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2987; i=matttbe@kernel.org; h=from:subject:message-id; bh=yQZm9eVkTr9yeWS98qWO8sSUzC9QPTMsOrDIzUhNZrk=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+171corI61OYN99UWA846j3qGcw+zHISrOBZO+BTaw PDA/7hnRykLgxgXg6yYIot0W2T+zOdVvCVefhYwc1iZQIYwcHEKwERmVjEy3FuZdWlJ6b6dOWfO zFxw9N+CE0X2Kq90ojoqpu7Mio92MmH4n81eNunyehVJy7fCVYcfxLoyicbxb5YvDvPfkpoU8iO VCQA= X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 When an MPTCP connection falls back to TCP after having been shut down, the data that is still in the write queue of the MPTCP socket is lost: a FIN is sent at fallback time, and this data cannot be sent after it. This can happen with TCP Fast Open (TFO), when a server writes data and shuts the connection down before the third ACK, and this ACK has no MPTCP options. When the MPTCP socket has been shut down, mptcp_try_fallback() also shuts the subflow down: if the DATA_FIN had already been sent, nothing would send a FIN on this subflow otherwise. The commit introducing this only considered the case where all the data had already been pushed to the subflow. The fix used here is to only shut the subflow down at fallback time if no new data is pending, i.e. if all the data before the DATA_FIN has already been sent. Otherwise, mptcp_check_send_data_fin() will do it once this data has been pushed, e.g. by the previous commit. Pending data that has been reinjected, e.g. after the failure of another subflow, is not new: it is already in this subflow. This issue has been found by an AI code review agent, while reviewing the code of the previous commit, and confirmed with a new Packetdrill test, where the server writes data and shuts the connection down before the third ACK, from which the MPTCP options are removed. Without this patch, a FIN was sent right after this ACK, and the data was never sent: inbound injected packet: 0.240127 . 501:501(0) ack 4103187975 win 450 outbound sniffed packet: 0.240207 F. 4103187975:4103187975(0) ack 501 wi= n 1050 outbound sniffed packet: 1.347800 F. 4103187975:4103187975(0) ack 501 wi= n 1050 outbound sniffed packet: 2.499829 F. 4103187975:4103187975(0) ack 501 wi= n 1050 outbound sniffed packet: 4.739843 F. 4103187975:4103187975(0) ack 501 wi= n 1050 server-tfo-fallback-shutdown-before-3rd-ack.pkt:27: error handling packet= : Timed out waiting for packet Fixes: d51991e2e314 ("mptcp: fix shutdown vs fallback race") Cc: stable@vger.kernel.org Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/protocol.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h index 011e73d04ee6..7d226ee38315 100644 --- a/net/mptcp/protocol.h +++ b/net/mptcp/protocol.h @@ -1333,7 +1333,11 @@ static inline bool mptcp_try_fallback(struct sock *s= sk, int fb_mib) msk =3D mptcp_sk(sk); if (!__mptcp_try_fallback(msk, fb_mib)) return false; - if (READ_ONCE(msk->snd_data_fin_enable) && !(ssk->sk_shutdown & SEND_SHUT= DOWN)) { + + /* no FIN before new data: see mptcp_check_send_data_fin() */ + if (READ_ONCE(msk->snd_data_fin_enable) && + !before64(READ_ONCE(msk->snd_nxt) + 1, READ_ONCE(msk->write_seq)) && + !(ssk->sk_shutdown & SEND_SHUTDOWN)) { gfp_t saved_allocation =3D ssk->sk_allocation; =20 /* we are in a atomic (BH) scope, override ssk default for data --=20 2.55.0 From nobody Mon Nov 23 20:27:02 2026 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794866947; b=5gXKwJatX3ampyC8bxYvsIimqIK0DtYiiUAAsuXrNC6NO3XAigHfZdEiz6IVEDaHMvis sjDQdaTb80X9CB4zz5oF4AFD64oPdDwHPr7PinjokDk6nAG0SrZJxfChOibMBVmdatPe2 ilAG6ZIQNFXH7ALiTPk4PL0Cy8aLp4HR9kR4yg/XnjEOS0XuRqQVI5UETtjSSCZYTsNS9 e0Oy2DhsC/lJoyrcdB+kS/7HYFSkPzfzYyXlJrpeGpQCI6xbDVVU/t/uoD6SaVMhPt1fv 0KjUQB74zO/Mmc9P/jnSgmEkbJyXk9utHiYT3qJMaodVMDxpkWBwNraOvttLC4JGBRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794866947; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=1S2JG0K8dQlVY7uMvfgeH0EUxwYxdfh4NPdqZIEsOw8=; b=C6WRoopyuZqGgTwt0s7TTWhU1Ux1jpGNb7AbEx1nMxn/Oay+XVoO/srODG2BlEMloqSN NyWyAB3qDB0sMLBTWgr+U0LjPrGW/7B2sgBhY2j0W/12UGCWxYumUvaTjpsYXV7lMrPEv 7Ar4rWIMHNiSuX1y5KJhm2X5xm4CABBly/NQWHrcs7lYl+4GuIwwp/VIwMrxRT4nLbuNy 8HjfNhFLhrdm9Yqc01wUfym6mvFCQPHXo4/EBJV335v83ZTpjRflr2W2s2L93n0PFPkuf Chw/AlHCaSYtuR3oTQKqFkhKKQfnXvtrsqqSrxHvWWrzjSq0DDfCaneMWMLfhxGHTng== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gzdAzHls; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3242E606A887; Mon, 16 Nov 2026 22:09:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gzdAzHls Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C6651F000C4; Mon, 16 Nov 2026 22:09:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1794866946; bh=1S2JG0K8dQlVY7uMvfgeH0EUxwYxdfh4NPdqZIEsOw8=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=gzdAzHlst/oVpS2s52CTsRAoa5D07MLUNCHLzFdWrKucjLubUDdeskYoYJURjWazw L3boWOY4zd7fFouLxIG3xRnJ2N4puO/xi682567esA27euPBYW22iTr/YvOBd4NMLF AQEF9jHvz7PDJNynNyLtb2Go3K7DqFaA8xfaM1m0z6FwEmH/ltJ2dU8o+9wjqG72Az 95kjOaC4dVv3Y5F5II7wLilSvp0MsUDZw+qR/OaZLwd0y8WEic8vhLrsdyHvQDmjUC a12wEPm4OjK1+49nAUNSfIC0qazDuSCMSe0G+pR18OBL2kg5elzOIR/qPV5Er5RGYg zr/6KOnDtqrmA== From: "Matthieu Baerts (NGI0)" Date: Mon, 16 Nov 2026 23:06:14 +0100 Subject: [PATCH net 7/7] mptcp: fix dummy mapping of overlapping segments X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-7-bf7656de653e@kernel.org> References: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> In-Reply-To: <20261116-net-mptcp-misc-fixes-7-4-rc4-v1-0-bf7656de653e@kernel.org> To: Mat Martineau , Geliang Tang , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Florian Westphal , Dmytro Shytyi Cc: netdev@vger.kernel.org, mptcp@lists.linux.dev, linux-kernel@vger.kernel.org, "Matthieu Baerts (NGI0)" , stable@vger.kernel.org, Chris Mason , Geliang Tang X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=3846; i=matttbe@kernel.org; h=from:subject:message-id; bh=cZPOlHWTnOxbxMx5o66RJt82bkh/T4a/OuHPb6biV0g=; b=owGbwMvMwCVWo/Th0Gd3rumMp9WSGLJ+170K8mA6VbLamnGrkQnDZYE/W5XW5nOwv1204/F3z nleU9cc7ihlYRDjYpAVU2SRbovMn/m8irfEy88CZg4rE8gQBi5OAZjITT6GPxxS+TPv8658373f s7DLK7H33yHuD/zsy8/pemYsmtfQMZ/hv9faeRss84vu7j28jMdT9fpGjTCXtg22infvM607sqL pLBcA X-Developer-Key: i=matttbe@kernel.org; a=openpgp; fpr=E8CB85F76877057A6E27F77AF6B7824F4269A073 From: Geliang Tang An MPTCP socket that has fallen back to TCP can silently lose received data if a segment partly overlaps data received earlier, and recv() then blocks, returning neither later data nor end of file. After a fallback, subflow_check_data_avail() makes up a dummy mapping for the skb at the head of the subflow's receive queue, in which map_seq and map_subflow_seq must describe the same byte. But since commit 2834f8edd74d ("mptcp: cleanup fallback dummy mapping generation"), it computes map_seq from the first byte of the skb, while map_subflow_seq is still computed from copied_seq, the next unread byte. mptcp_subflow_get_mapped_dsn() then returns the data sequence number (DSN) of the first byte of the skb, instead of the one of copied_seq. These two bytes differ for a segment that starts before rcv_nxt and ends after it, since TCP does not trim it. mptcp_init_skb() then gives the new bytes of this skb a DSN that is too low, and __mptcp_move_skb() skips some of them as old data, leaving a hole in the stream: bytes 0 to 999 are received, the skb holds bytes 900 to 1499 byte 1000 gets the DSN of byte 900: too low by the 100 old bytes that is 100 below ack_seq, the next DSN that MPTCP expects __mptcp_move_skb() skips bytes 1000 to 1099 as old data ack_seq is the DSN of byte 1400, copied_seq is byte 1500 later data starts at the DSN of byte 1500: out of order the TCP FIN becomes a dummy DATA_FIN after the last byte ack_seq does not reach it, so there is no end of file Fix this by computing map_subflow_seq from the first byte of the skb as well: mptcp_subflow_get_mapped_dsn() then returns the DSN of copied_seq. Chris Mason sent the same fix in private, and found this issue with the help of an LLM. It has been reproduced in a VM, with the reproducer he shared, and with a new Packetdrill test: after a fallback to TCP, a segment overlapping data already received is injected. Without this patch, the new bytes at the beginning of this segment were lost, and the connection stalled, with no end of file: reader 30.64: conn 1 BREAK: at my offset 1000 the bytes claim offset 11= 00: A GAP OF 100 BYTES reader 30.64: READ-TOTAL conn 1 outcome iii-gap-or-repeat bytes 1400 of= 2500 [...] [...] end: hang: no data and no end of file for 30 s And with the Packetdrill test: dss_fallback_overlap_client.pkt:24: runtime error in read call: Expected = result 2500 but got 1400 with errno 115 (Operation now in progress) Fixes: 2834f8edd74d ("mptcp: cleanup fallback dummy mapping generation") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/4c48d016490d43b6892c622cbae858b48f176cff.1794= 304840.git.tanggeliang@kylinos.cn [1] Co-developed-by: Chris Mason Signed-off-by: Chris Mason Signed-off-by: Geliang Tang [ Combine the commit messages of Geliang's [1] and Chris's versions. Commit message: how the issue was found, and its symptoms. ] Signed-off-by: Matthieu Baerts (NGI0) --- net/mptcp/subflow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c index 00677fb3efcd..6f07544bfe40 100644 --- a/net/mptcp/subflow.c +++ b/net/mptcp/subflow.c @@ -1496,7 +1496,7 @@ static bool subflow_check_data_avail(struct sock *ssk) skb =3D skb_peek(&ssk->sk_receive_queue); subflow->map_valid =3D 1; subflow->map_data_len =3D skb->len; - subflow->map_subflow_seq =3D tcp_sk(ssk)->copied_seq - subflow->ssn_offse= t; + subflow->map_subflow_seq =3D TCP_SKB_CB(skb)->seq - subflow->ssn_offset; subflow->map_seq =3D __mptcp_expand_seq(subflow->map_seq, subflow->iasn + TCP_SKB_CB(skb)->seq - --=20 2.55.0