From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8F191E47CC; Tue, 13 Oct 2026 12:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791894896; cv=none; b=M6iaAiPpvzLy74pQo7ckW8PqBF0Dnzt0cHmssQ8IGytU9CwDg2QFrmySMfRP4hyzQoyBUr3pYLvduFWZNWwrdwBHrZXXTmQV7AB7XhQORvaWR7MnMbbvY0CESc6bLud2uSuOrhBFeem4kAzpQtW2hPxMo112rb2+cADGve3SQXg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791894896; c=relaxed/simple; bh=UZgVubkefN6J6Jf0MREHaaLFSqOn9fL7XXx1h0uTK5o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D7vTREvsvQFQQ83ey5nxoJlRZRvNvjr+ml5fz/if7qJD5ZVgFWm0tnHDI6juiE4Of9sL8zZAOgfIcN+jZxhGK4INijU8IIqOQC76+OwzMu4U94ZXDOipbuZfKqrwd0C8ZO1WQgGDXGOSax9smYbZ8T+ZOzfsx1iNxa+pjeL42nk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wxEgmDEz; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="wxEgmDEz" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 387261F000FF; Tue, 13 Oct 2026 12:34:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1791894895; bh=7O14GIeZRWhJXDjdz3FHz/I8SMsjk+pw8Ks8ffhu1Ms=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=wxEgmDEz0BnZcYh3aOl3/Spg2A+mGGJllGeP9vCPKMKlKtNsb0g5NqVrVO/PHb5yH Rlo87P6uSZc9bfF/pSdkXVRFrXMzz2WwAlujhZWcc9Sq6cyZDkyZJoagZrEA3iXZo7 73dTxjuUIvux5utI+a8SJeKwqQzRpvebAfqhMBC4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jeff Jo , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 6.12 094/497] tcp: refresh TS.Recent for accepted old ACKs Date: Tue, 13 Oct 2026 13:34:21 +0200 Message-ID: <20261013112910.122368033@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261013112907.864180619@linuxfoundation.org> References: <20261013112907.864180619@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jeff Jo [ Upstream commit 1b92780ae4fc3be64f05d97ed8833c445e73b0cf ] A TCP packet can carry new data while acknowledging traffic in the opposite direction. With overlapping traffic in both directions, a delayed packet's acknowledgment can be older than one Linux has already accepted, even when that packet fills a gap in the received data. Linux accepts the data, but tcp_ack() takes the old_ack path and skips updating TS.Recent, the timestamp saved for outgoing acknowledgments. The reply therefore echoes an older timestamp. If the sender uses this echo to measure round-trip time after a long idle period, its estimate includes the idle time and can reduce its sending rate. Update TS.Recent in old_ack using tcp_replace_ts_recent(), before SACK processing can trigger a transmission. This reuses the existing timestamp and sequence checks, including PAWS protection against old duplicate packets. ACK validation already rejects old ACKs in SYN_RECV before this path, so no additional state check is needed. Echoing the timestamp of the packet that fills the receive gap follows RFC 7323 section 4.3. In a socket reproduction with 300 seconds idle, controlled reordering and retransmission to exercise timestamp-based RTT sampling, the sender's smoothed round-trip time was 37.5 seconds without the fix and 15.5 ms with it. Fixes: 12fb3dd9dc3c ("tcp: call tcp_replace_ts_recent() from tcp_ack()") Assisted-by: LLM sparse Signed-off-by: Jeff Jo Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c3aeb985f819d..5c581d4821c1d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4134,6 +4134,12 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) return 1; old_ack: + /* An old ACK can carry new data. Update TS.Recent before SACK + * processing can trigger a retransmission. + */ + if (flag & FLAG_UPDATE_TS_RECENT) + tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq); + /* If data was SACKed, tag it and see if we should send more data. * If data was DSACKed, see if we can undo a cwnd reduction. */ -- 2.53.0