MPTCP Linux Development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yilin Zhang" <yilinzhang@moonshot.ai>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH] tcp: fastopen: check rsk_drop_req() in tcp_fastopen_create_child()
Date: Wed, 02 Sep 2026 12:37:58 +0000	[thread overview]
Message-ID: <20260902123759.5674B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260902121247.3248539-1-yilinzhang@moonshot.ai>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Missing `bh_unlock_sock(child)` before `sock_put(child)` causes a locked spinlock and preemption/softirq-disable leak.
- [High] Returning NULL from `tcp_fastopen_create_child()` fails to abort the request, causing a rejected MPTCP MP_JOIN request to incorrectly fall back to standard SYN processing, leading to a spurious SYN-ACK and resource waste.
--

commit c3cab231705bf3a0b9db9f8531e40d30d546e830
Author: Yilin Zhang <yilinzhang@moonshot.ai>

tcp: fastopen: check rsk_drop_req() in tcp_fastopen_create_child()

This commit addresses a use-after-free vulnerability by checking
rsk_drop_req(req) in tcp_fastopen_create_child(). If an MPTCP MP_JOIN SYN
with a valid Fast Open cookie triggers the fatal fallback in
subflow_syn_recv_sock(), the request and child socket are now dropped.

> diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c
> index 471c78be55137..b8b3abbee253d 100644
> --- a/net/ipv4/tcp_fastopen.c
> +++ b/net/ipv4/tcp_fastopen.c
> @@ -337,6 +337,11 @@ static struct sock *tcp_fastopen_create_child(struct sock *sk,
>  	if (!child)
>  		return NULL;
>  
> +	if (own_req && rsk_drop_req(req)) {
> +		sock_put(child);

[Severity: Critical]
Does this code leak the socket lock?

When a child socket is created and returned by syn_recv_sock(), it is
returned with the socket spinlock held. If we call sock_put(child) here
without first calling bh_unlock_sock(child), does this leave the spinlock
locked and softirqs disabled, leading to a soft lockup?

> +		return NULL;

[Severity: High]
Does returning NULL here cause the dropped request to be incorrectly retained?

When NULL is returned, tcp_fastopen_create_child() signals a normal Fast Open
failure rather than a hard drop. tcp_conn_request() will then assume Fast Open
failed, proceed to the standard SYN processing path, link the dropped request
into the SYN queue, and send a SYN-ACK:

net/ipv4/tcp_input.c:tcp_conn_request() {
    ...
	} else {
		tcp_rsk(req)->tfo_listener = false;
		if (!want_cookie &&
		    unlikely(!inet_csk_reqsk_queue_hash_add(sk, req))) {
			reqsk_free(req);
			dst_release(dst);
			return 0;
		}
		af_ops->send_synack(sk, dst, &fl, req, &foc,
				    !want_cookie ? TCP_SYNACK_NORMAL :
						   TCP_SYNACK_COOKIE,
				    skb);
    ...
}

Should this path return an error pointer or use a drop mechanism to ensure the
request is completely aborted, rather than triggering the fallback path?

> +	}
> +
>  	spin_lock(&queue->fastopenq.lock);
>  	queue->fastopenq.qlen++;
>  	spin_unlock(&queue->fastopenq.lock);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902121247.3248539-1-yilinzhang@moonshot.ai?part=1

  reply	other threads:[~2026-09-02 12:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 12:12 [PATCH] tcp: fastopen: check rsk_drop_req() in tcp_fastopen_create_child() Yilin Zhang
2026-09-02 12:37 ` sashiko-bot [this message]
2026-09-02 13:32 ` MPTCP CI
2026-09-02 14:12 ` Jiayuan Chen
2026-09-02 15:31   ` Matthieu Baerts
     [not found] <c4d4d8c-34af-4ea8-ace8-e10e547d6744@kernel.org>
2026-09-03  7:06 ` Yilin Zhang

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=20260902123759.5674B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=mptcp@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yilinzhang@moonshot.ai \
    /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