From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.198 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796256117; b=Kpthj6RznE9PkagXlFLGOHartXG5tQR0wWturGYXQJXoE8bCYtZIR28AsMj7S0VGd67s nlH1o0ATpmwe9gwq+2GxtLrcsyOkPrWlVsmTpsKO8hdNZjmWb460havbMC2XLvu0rv/Ye Kokdcu85B1dlVgTSf5WmHdNE2mXwfF/2tAsBDroPoh5YsL18Y6yugz8erEIwppxfNo3LN 6ipDkHEXq/xLX+mG46u3FnXavtZnI3vO2/cFfw/1zVIWgOymgmkbnQ6pViX84E+66EA2X wnL94/z9mB5gjhWlXAJA5GdHinFOHmxF5zO1mp36vVgQSEZAgqbGSvp7ywyt0wp0Gtg== 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=NkjR5xN1nCldomUinldDWZs1Q3ECARZIdgkTVoC8cotU3Rc2MoqW2gdgOphQJrcubv/d /+0YIenD3VZEOoDFgwadOUbzt50USQSRz4XGJ46X9+RmCOcYzelVBOUaLA5ojO4e3l+4j qxeQLDOlT+4muD58SRcRTHAHOiJVEBgkGsQjrUWe17MlsIaGZjTreqpfzrnJGY+UecClu bL9zkavkFzAsa7TXoHPjYoZhhPGb5VDL8AoYLdmHZAioX2G8YaEqa5HSmESsx+M94x3AQ f7FnS4k50fkP7NJDZWCZwaivHxpAkvB6ASqtxPE4AAZNOB3hdpXQnSuDEZ82wElODdA== 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.198 Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) (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 D3174606A32C for ; Thu, 3 Dec 2026 00:01:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D3174606A32C 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-f198.google.com with SMTP id d9443c01a7336-2f040056fd0so2328435ad.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=ZyECo414wORk6YTreF509G7USIzCrqeALNPscolIu0WiRz7zlALXJmoAR+cEGHu2Wm 9FwAXTvuKJa/qkjbXMJeiN12pniuRB32wCXSMEMCg99/y+Y64CHU/bcGHPUHz3FUVxGT +z06I/Q4sjUDkwUerLhVEjXZhiVivoq3IwBNKp9ShoRE2JOrKPU4RDjdkm+monyegRSW qcN2oVcLlU6seObc+fJcnq4E5T+Z6D9rLelInLOZDGoK/9ZuS+oyT7PxEoda96lcyw+g BTkj2BZArXY8/NciLJF5yD8UIXszWZ/y0AjAIPt/ePLy8PRC1gWYBtS4gVjBs3TeX+tM YSlA== X-Forwarded-Encrypted: i=1; AL+hErGSer62g7AalSUnsGZB4TSthagrU5wegL/It4haOeqiNpczl/KNJ9e+i+Tvq0uEi7sUiHpHR0kwW8l/V/A=@vger.kernel.org X-Gm-Message-State: APuU4Z+KbAHj/aUy4+q3dOD42lmRDzM/CmpsOTk6ug41DzenFfyphB01 hHKkOANYK6FCRQi4xo9CGWZ18mwN0J/kq1ETlFlr2jU3VFekJdSB0tGQINfQogtnrDwz0MgLrKI M9djiSg== 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: linux-kernel@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