The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Kuniyuki Iwashima <kuniyu@google.com>
To: Paolo Abeni <pabeni@redhat.com>
Cc: Jiayuan Chen <jiayuan.chen@linux.dev>,
	xxx@vger.kernel.org,  Eric Dumazet <edumazet@kernel.org>,
	Neal Cardwell <ncardwell@google.com>,
	 "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	 netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] tcp: fix spurious RST when SYN_RECV race is lost
Date: Thu, 3 Dec 2026 09:01:54 +0900	[thread overview]
Message-ID: <axCxXl0yrDdtKDph@google.com> (raw)
In-Reply-To: <677b5e17-01e1-4321-9c24-ad222ebe48bb@redhat.com>

On Wed, 02 Dec 2026 18:54:37 +0100, Paolo Abeni wrote:
> On 11/25/26 13:46, Jiayuan Chen wrote:
> > When the last ACK of 3WHS and the first data packet are processed on
> > different cpus, both can find the same req. The winner creates the
> > child and adds it to the accept queue. If this makes the accept queue
> > full, syn_recv_sock() fails for the loser and tcp_check_req() sends a
> > RST when tcp_abort_on_overflow is set. Only after that it finds the
> > req was stolen, and the packet is fed to the child.
> > 
> > The client gets a RST for a connection the server has accepted, and
> > the server application can even read the data.
> > 
> > Drop the req first, and do not send the RST if another cpu already
> > took it.
> > 
> > Fixes: 079096f103fa ("tcp/dccp: install syn_recv requests into ehash table")
> > Signed-off-by: Jiayuan Chen <jiayuan.chen@linux.dev>
> > ---
> >   net/ipv4/tcp_minisocks.c | 14 +++++++-------
> >   1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
> > index a05bb02e204c..934012cdac27 100644
> > --- a/net/ipv4/tcp_minisocks.c
> > +++ b/net/ipv4/tcp_minisocks.c
> > @@ -962,6 +962,13 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
> >   	}
> >   embryonic_reset:
> > +	if (!fastopen) {
> > +		if (!inet_csk_reqsk_queue_drop(req->rsk_listener, req)) {
> > +			*req_stolen = true;
> > +			return NULL;
> > +		}
> > +		__NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS);
> > +	}
> >   	if (!(flg & TCP_FLAG_RST)) {
> >   		/* Received a bad SYN pkt - for TFO We try not to reset
> >   		 * the local connection unless it's really necessary to
> > @@ -973,13 +980,6 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
> >   		reqsk_fastopen_remove(sk, req, true);
> >   		tcp_reset(sk, skb);
> >   	}
> > -	if (!fastopen) {
> > -		bool unlinked = inet_csk_reqsk_queue_drop(req->rsk_listener, req);
> > -
> > -		if (unlinked)
> > -			__NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS);
> > -		*req_stolen = !unlinked;
> > -	}
> >   	return NULL;
> >   }
> 
> @Kuniyuki, @Neal: could you please have a look here?

Looks good, thanks !

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

      reply	other threads:[~2026-12-03  0:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 12:46 [PATCH net] tcp: fix spurious RST when SYN_RECV race is lost Jiayuan Chen
2026-11-25 12:53 ` netdev-bot+sinfo
2026-12-02 17:54 ` Paolo Abeni
2026-12-03  0:01   ` Kuniyuki Iwashima [this message]

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=axCxXl0yrDdtKDph@google.com \
    --to=kuniyu@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=xxx@vger.kernel.org \
    /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