From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.199 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796256117; b=hl/Im3xm7Q/93jHzYMv+B7/7s8CFprUOJ+/EdFPGkpUSjfagWdtF3VvZLkkJtVdaAf6W 1dIwVa8hIRIlPGffdYyDYJDLWM73GVmQZ/xwXH2AMxOFtWJYgO9D7MSeHNt2kqfYHCEtz PowqVqusvufD4wefUbiL8LjM8D5mfQPOGURHEUlotTcCicjK3uzxoCQdSPnPK6/oAXQN0 rVNh+/Av/YXONgCtAvRca+bDs7PHfZpCKFVxqNZeMsYKLORFP2LcSNt5Ci4Lnqb1m36dd R+cJBb2ms4F+8AI51zfNKejRpoC+Nr4fc3YVFGEawnR7HYx/OT6AQkcCdHaY0JpsQOg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796256117; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=2MuDwqGB667ICahe2dNjc3mda23pUht8woW5tanVL5k=; b=zVenFyMa0AC4NSzag63EimA5pn2v+u9kCxI/IVaWynxD+BdZBHDJeMCr7zN7fDyKQOCP VasH6mduNESrBYzMLbZDeLhCjo01AjNi24hUWwRDiEIUWquj4DptlvZBsgM9KzUj3T0ra 5wW2h5YIhhzzMa2D3zDNEpAJI+PZ4xpUMt/G9UC0WPHPesFYggmEMPqI6fHr/xPkrDpwJ BUWah5ob+rWBqRUopIm6r1CtUBZ54vjnWgOuj/xU9iXfKgK5S0MojoOFI3ZEIs6s/8m1T Y019HPQyrVfrZBj3DFW8x2lA90UrvRK2mV/VE9Fkkp+cVSZDVGgAHcsbTqfhaIoYamA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=O+uBWbSY; arc=none smtp.remote-ip=209.85.214.199 Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C7280606A322 for ; Thu, 3 Dec 2026 00:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C7280606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--kuniyu.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=O+uBWbSY Received: by mail-pl1-f199.google.com with SMTP id d9443c01a7336-2f18f603e67so2619615ad.1 for ; Wed, 02 Dec 2026 16:01:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796256116; x=1796860916; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=2MuDwqGB667ICahe2dNjc3mda23pUht8woW5tanVL5k=; b=O+uBWbSYDrZb0DpbweHKg48VwAsCz8flAU5/+a/Vy+qYAocld+XncfvTx7gRxNpauP ovJHDJnpQs3gQhWHD46B4idhUgKvmL655I2ESk0ISElLS7OHWzBz15mfLEUb+JrIQCbm 4GMRToIwejtpexr2UciKs4QLOJiF6gCw61/h4uiqUCxdzlc7/j9uaXoI00ywzuhjt/40 dqr4hLBrfSHoVcDZ2krqq6ohIIey27rUUyUQI2vC5KharFoB2vVd95z8/iSmZZkUjLrC Gs7Kkmeb8escn4EH6RS6wUzgD308rhauApdEWm6d6FSqau4R7z1AkrvAALDCUHnGsXoO u8hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796256116; x=1796860916; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=2MuDwqGB667ICahe2dNjc3mda23pUht8woW5tanVL5k=; b=BFn3AokALc3Rv10GL0IiK6L5nExoUGl7+Qvus03EyLpAp/VxeP5ECXWfQJYFq2r7yj IqE9t7FWW8bUXhMXMF/BVHLTgJ9bKlhEJynsT9lXchr6vetvPsmgcJhVCb2M5bU0sCZP NSC9SfHihYT0U69vq2+B8W4XXHwH+zz+4IDjM04BhVYBX7KUIJhJ9MG6WeezulmvJQDt OwOVhhOlIawsuwJb2s7VhRc5HVOPFycaIVDmfg8fKfQ7pqKMypVXc7RzTYY5DO2amiP9 zEzkMzZSkWEyWX5Woo6imDSuHMv4iM1jiNP77ZM16CYVvrWAZYLk3hR7n369pkmxvl21 PDZw== X-Forwarded-Encrypted: i=1; AL+hErG2Y0ApQqWtDmuo3gowWqBFLo83kK4Rp5HWon/Qi7meOpINJ5ErRlO/mGk62287/fDO2kN3pdI=@vger.kernel.org X-Gm-Message-State: APuU4Z+t+uMReD1buZ3r2tKYhPpKS4sLoLm0neCc0Vc9CIB6M65kjkAr DxQ5+Di8cGEyZdMjJgUqmM6u4pnT8E7lvAl+B8EeudSg30dTcnyaPqC3yU0XPeHzixJTPmE6uTn gwL5Z4w== X-Received: from plps3.prod.google.com ([2002:a17:902:9883:b0:2ef:deb6:1cc5]) (user=kuniyu job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:f685:b0:2f1:3f2a:d2a8 with SMTP id d9443c01a7336-2f1970dbf05mr2809735ad.29.1796256115315; Wed, 02 Dec 2026 16:01:55 -0800 (PST) Date: Thu, 3 Dec 2026 09:01:54 +0900 In-Reply-To: <677b5e17-01e1-4321-9c24-ad222ebe48bb@redhat.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261125124653.289409-1-jiayuan.chen@linux.dev> <677b5e17-01e1-4321-9c24-ad222ebe48bb@redhat.com> Message-ID: Subject: Re: [PATCH net] tcp: fix spurious RST when SYN_RECV race is lost From: Kuniyuki Iwashima To: Paolo Abeni Cc: Jiayuan Chen , xxx@vger.kernel.org, Eric Dumazet , Neal Cardwell , "David S. Miller" , Jakub Kicinski , Simon Horman , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="us-ascii" 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 > > --- > > 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