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=1796384497; b=LqS0cABvlzhfARrDU0oaEYxsdYVhLgcZJU0lyAqqdyVUMcphaG2FpJaICPZHkN1UvJ9i kBTVFlIkyZd77BXeZrcKa64f0e+kFAVooUxaW+ke1wemUp53WlyLrBuEmyyLTAUhqFmL7 HAs7iZ/9WcwEfjcckx5wDew9QXaVQPjJAGsvczjIdWqXbPbRTJ82xFteKGcglLB76Shsy OgjZm50uN6yoOvjitxruBu5hooN9or8s7IDOvfeRB3x5tkYClzJ4TzoqYR7zfmVY8011R 6gchSYlEYOP8RVBIqlYtCHUgh49ypxK8I1Swt5v2YSnlAUB/l1GHwbqZmHX9QWc7BnA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384497; 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=UhEj2baY120WweTJIb58JDKZb7XSy1vGz/Yz7eAYHgg=; b=Xy0bj0hYFoa+QDZmJUPoMKDhZxgcX+hrf8NkSB8yGBfY2V+s9yWy8sDBbintLe6vpYkr 1TD5/NSc9uwyHQmSn3nJEs7NkzSnLUPeT2WvfoHr0K1bOPwx3rEkK9NPTEM1vfc5aXXnJ oywQXulCLKhM9BPNKX23imsv+AThanCFLnk8tkhfcjoT398dildxL2bZjorja4r9+Ft/X gMQ0j7lT/8Q98Gzt3El2K63jG1hJcO3p1yT8s12zVqmjTdr+3QzqouWTHixkBGPfIfdfx 9tNzOy3HtxCj+QBDfqavQWRz/fJmVwDjYhXuY33D8Ir6+8DyJS4NMG+pIj2x4Q7Kvfg== 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=blNb7ecA; 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 EBB8F606A330; Fri, 4 Dec 2026 11:41:36 +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=blNb7ecA Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67FA71F000C2; Fri, 4 Dec 2026 11:41:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384496; bh=UhEj2baY120WweTJIb58JDKZb7XSy1vGz/Yz7eAYHgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=blNb7ecAuPze1g25wdLHVHk67SUU0Q6RNaXa88OmNCQdVfTHzGELiyNLyB2Z16ZYJ /dMukgleZLRZMKpRb5Y1/ktnSAF25uO4uDNrfhcO6tMD+gy8mkCz8m49HTIEBnZwJZ eLnV26t/WJwLKrFaiCwqgeVDJdNOK1YnlPqZi4dY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Qingfang Deng , Eric Dumazet , Kuniyuki Iwashima , Neal Cardwell , Paolo Abeni , Sasha Levin Subject: [PATCH 6.6 0175/1167] tcp: initialize send sequence numbers before deferring TFO Date: Fri, 4 Dec 2026 18:53:22 +0900 Message-ID: <20261204100706.630942998@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: patches@lists.linux.dev 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: Qingfang Deng [ Upstream commit 57889a8f6d49fc153aa0017d13086ab736567f8a ] TCP_FASTOPEN_CONNECT can return from connect() before tcp_connect_init() when a cached cookie or cookieless Fast Open allows deferring the SYN. At this point write_seq contains the initial sequence number, while snd_una and snd_nxt have not been initialized to that sequence number. Consequently, inet_diag and /proc/net/tcp{,6} report the initial sequence number as the send queue length despite no SYN or payload being queued. Initialize snd_una and snd_nxt to write_seq before marking the connection as deferred. Both sequence-based queue lengths then remain zero until the first write starts the connection and runs tcp_connect_init(). Fixes: 19f6d3f3c842 ("net/tcp-fastopen: Add new API support") Signed-off-by: Qingfang Deng Reviewed-by: Eric Dumazet Reviewed-by: Kuniyuki Iwashima Reviewed-by: Kuniyuki Iwashima Reviewed-by: Neal Cardwell Link: https://patch.msgid.link/20261102035943.9700-1-qingfang.deng@linux.dev Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin --- net/ipv4/tcp_fastopen.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/ipv4/tcp_fastopen.c b/net/ipv4/tcp_fastopen.c index d36a1ceb75101..9ba9e5d2aba14 100644 --- a/net/ipv4/tcp_fastopen.c +++ b/net/ipv4/tcp_fastopen.c @@ -455,6 +455,8 @@ bool tcp_fastopen_defer_connect(struct sock *sk, int *err) if (tp->fastopen_connect && !tp->fastopen_req) { if (tcp_fastopen_cookie_check(sk, &mss, &cookie)) { + WRITE_ONCE(tp->snd_una, tp->write_seq); + WRITE_ONCE(tp->snd_nxt, tp->write_seq); inet_set_bit(DEFER_CONNECT, sk); return true; } -- 2.53.0