From: "Yilin Zhang" <yilinzhang@moonshot.ai>
To: "Mat Martineau" <martineau@kernel.org>,
"Matthieu Baerts" <matttbe@kernel.org>,
"Jiayuan Chen" <jiayuan.chen@linux.dev>,
"Paolo Abeni" <pabeni@redhat.com>
Cc: "Yilin Zhang" <yilinzhang@moonshot.ai>, <netdev@vger.kernel.org>,
<mptcp@lists.linux.dev>,
"Kimi Security Team" <bug-report@moonshot.ai>
Subject: [PATCH v3] mptcp: do not use Fast Open on MP_JOIN subflows
Date: Sun, 20 Sep 2026 14:17:55 +0800 [thread overview]
Message-ID: <20260920061755.3575063-1-yilinzhang@moonshot.ai> (raw)
In-Reply-To: <20260903094010.4066892-1-yilinzhang@moonshot.ai>
tcp_fastopen_create_child() hands the SYN packet itself to
subflow_syn_recv_sock(). For an MP_JOIN request this takes the
fatal fallback: the cloned child is destroyed and handed back with
drop_req flagged, but tcp_fastopen_create_child() does not check
the flag and queues it, so accept() can expose the freed child.
MP_JOIN cannot use Fast Open: data on a subflow requires the
completed HMAC exchange (RFC 8684, sec. 3.2). Refuse it (only the
TFO path passes a SYN skb here) and let tcp_conn_request() fall
back to the regular MP_JOIN handshake; also strip the Fast Open
cookie from MP_JOIN SYN/ACKs.
Fixes: 90bf45134d55 ("mptcp: add new sock flag to deal with join subflows")
Reported-by: Kimi Security Team <bug-report@moonshot.ai>
Suggested-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Suggested-by: Paolo Abeni <pabeni@redhat.com>
Suggested-by: Matthieu Baerts <matttbe@kernel.org>
Signed-off-by: Yilin Zhang <yilinzhang@moonshot.ai>
---
v3:
- refuse TFO for MP_JOIN in subflow_syn_recv_sock() and fall back to
the regular handshake; the TCP-side hunks from v2 are dropped
- strip the TFO cookie from MP_JOIN SYN/ACKs
v2:
- https://lore.kernel.org/netdev/20260903094010.4066892-1-yilinzhang@moonshot.ai/
v1:
- https://lore.kernel.org/netdev/20260902121247.3248539-1-yilinzhang@moonshot.ai/
net/mptcp/subflow.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index af81ad5..2b454d4 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -348,6 +348,10 @@ static void subflow_prep_synack(const struct sock *sk, struct request_sock *req,
if (foc && foc->len > -1)
ireq->tstamp_ok = 0;
+ /* MP_JOIN cannot use TFO, do not send a cookie in the SYN/ACK */
+ if (foc && mptcp_subflow_rsk(req)->mp_join)
+ foc->len = -1;
+
if (synack_type == TCP_SYNACK_FASTOPEN)
mptcp_fastopen_subflow_synack_set_params(subflow, req);
}
@@ -832,6 +836,12 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,
if (fallback)
goto create_child;
+ /* a SYN skb here comes from TFO, which MP_JOIN cannot use: just
+ * fall back to the regular path.
+ */
+ if (subflow_req->mp_join && (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_SYN))
+ return NULL;
+
/* if the sk is MP_CAPABLE, we try to fetch the client key */
if (subflow_req->mp_capable) {
/* we can receive and accept an in-window, out-of-order pkt,
--
2.34.1
next prev parent reply other threads:[~2026-09-20 6:19 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 9:40 [PATCH v2] tcp: fastopen: check rsk_drop_req() in tcp_fastopen_create_child() Yilin Zhang
2026-09-10 8:12 ` Paolo Abeni
2026-09-10 10:13 ` Matthieu Baerts
2026-09-10 12:15 ` Jiayuan Chen
2026-09-10 16:12 ` Matthieu Baerts
2026-09-11 2:25 ` Jiayuan Chen
2026-09-11 6:42 ` Yilin Zhang
2026-09-11 9:33 ` Matthieu Baerts
2026-09-20 6:17 ` Yilin Zhang [this message]
2026-09-20 6:19 ` [PATCH v3] mptcp: do not use Fast Open on MP_JOIN subflows Yilin Zhang
2026-09-21 9:43 ` Matthieu Baerts
2026-09-21 15:55 ` Paolo Abeni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260920061755.3575063-1-yilinzhang@moonshot.ai \
--to=yilinzhang@moonshot.ai \
--cc=bug-report@moonshot.ai \
--cc=jiayuan.chen@linux.dev \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=mptcp@lists.linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox