From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796384707; b=PeJPlRVuZXH4JObKjZDtHdd0Mxonm7UXvLQ5Zc+zAnlld9eNv9MDUB/DubUtks37u+so b/IDHdY9qwLaOSYNowFTcx/LSB2r/0L0YSkzrUOLX3SnRm9i74PUmT09sJw+XvTjFpGic WsliEZ1QaXAj6O9RSi2aAKIK+HNEFUKzamoBDN9LdxsDcwAh+LNMqk0N1rmHQfYk4xnQB AZbrKaIe2fflZkFY0yy66U3gveOGQDdI/ZHNxekuu54x2pyiCsXGQhO/QzEQCi0ZnFs7m hoC7XCAKl0e3boJDoFa2Zkd98yfKMp2MNjSXoj1MckSbe69t/X66e4pHfeek3rkZ8bw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384707; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=RfMwLIjO+VNJdNrc6yqBQtl+wL4z6y+NA6x9AHddTi4=; b=XSm63QBGA0ZKmhKSRiTyTdeNPvZDFu9TJ71oDr07ck+81KMVCc5U31rRZ2FIaNAST12n qHaLbd9MqsPr3yZLyeADXHI1Z3YtuDOaa3HbEG8qfB/+NBJZsCVXpcB4KZA0nYsgy9MHp BuIYEv3+Fq0805vWjnc3iqL3fXuSj/IkW4//gJq8LbyQzGVs7frlVwB0rQywGhz39Dku3 oD/0+tyr5tPd6yExcCnlh/1z6Owb38N3meY2G4+hNP8/Qd9H9BsZNvThHz8NYBb9yv/wk oF+aQGuQu6CyXpllrvUatFzRd8qP+KwpABAkTYyAqTJ+4ga36gWXfYRmGSWBavEJ5Hw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=GUJro9x0; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF0EE606A32F; Fri, 4 Dec 2026 11:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=GUJro9x0 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D2E61F000C2; Fri, 4 Dec 2026 11:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384707; bh=RfMwLIjO+VNJdNrc6yqBQtl+wL4z6y+NA6x9AHddTi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=GUJro9x0VZN0aE9IYLdS5oAe0sUfZ6+/UpH/iCSQZK/ikr+e5d5Iu78vUuiJSO4yq LcP4UK8U2HfbUOLtTtQgOmrhqckhHgO7BN/tsli0CVd83GSfxz7A715ekq8jbCgWdV ueIYxoSx7iDHcPwmfrp40gTM3d0AyVNXU4VqeJAM= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Kuniyuki Iwashima , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.6 0259/1167] tcp: Pass req->rsk_listener to inet_csk_reqsk_queue_drop() in tcp_check_req(). Date: Fri, 4 Dec 2026 18:54:46 +0900 Message-ID: <20261204100708.809224412@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kuniyuki Iwashima [ Upstream commit a9782a6f2bbd0c444689725a710d8b21eab61bc5 ] When connection migration happens in tcp_v[46]_rcv(), a new listener is passed to tcp_check_req(). When either of the following is true, * the new listener queue is full and net.ipv4.tcp_abort_on_overflow is set * the packet has RST or (not stripped) SYN tcp_check_req() sends RST and calls inet_csk_reqsk_queue_drop(). Here, the new listener is passed, and its qlen is decremented wrongly while reqsk is tied to the old listener. Once qlen underflows, inet_csk_reqsk_queue_is_full() always return true, and the new listener stops serving. Without the patch, this script times out while waiting for SYN+ACK since the new listener drops SYN, but with the patch, 3WHS completes. 0 `sysctl -q net.ipv4.tcp_migrate_req=1` +0 `sysctl -q net.ipv4.tcp_syncookies=0` +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0 +0 bind(3, ..., ...) = 0 +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 4 +0 setsockopt(4, SOL_SOCKET, SO_REUSEPORT, [1], 4) = 0 +0 bind(4, ..., ...) = 0 +0 listen(4, 128) = 0 +0 < S 0:0(0) win 32792 +0 > S. 0:0(0) ack 1 <...> +0 listen(3, 128) = 0 +0 close(4) = 0 +.01 < R 1:1(0) win 0 +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 5 +0 listen(5, 1) = 0 +.01 < S 0:0(0) win 32792 +0 > S. 0:0(0) ack 1 <...> +0 < . 1:1(0) ack 1 win 32792 +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 +0 accept(3, ..., ...) = 6 Let's pass req->rsk_listener instead. Fixes: d4f2c86b2b7e ("tcp: Migrate TCP_NEW_SYN_RECV requests at receiving the final ACK.") Signed-off-by: Kuniyuki Iwashima Link: https://patch.msgid.link/20261111020304.1532064-2-kuniyu@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp_minisocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index 9c7103b740f53..d1e71a60eeb09 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -858,7 +858,7 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb, tcp_reset(sk, skb); } if (!fastopen) { - bool unlinked = inet_csk_reqsk_queue_drop(sk, req); + bool unlinked = inet_csk_reqsk_queue_drop(req->rsk_listener, req); if (unlinked) __NET_INC_STATS(sock_net(sk), LINUX_MIB_EMBRYONICRSTS); -- 2.53.0