From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9B7742F7461; Tue, 12 Aug 2025 17:42:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755020526; cv=none; b=n2f2+vhBRGTlGl9eJFYQy8ha1cffLeey1H3NXvKp6zV0zt4j1j/rfy+kXjsPlMqMB8pvSZZBaC0JaY2/jsdOEfBA5oK18iSv+PLD+Ns1F/Iq6UFp7MZZicm1Z51QgsHE/TwRDRV8vwyhJh3F1KidFbVfg2fkM8qG/0NiGr5b14I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755020526; c=relaxed/simple; bh=L+d3EGMD+lStBTMrATB2cCMg6DRH9Z/bHwfMei3RUhs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lbabVk5LqOqpqQSXaK4EXsfYLf26x5nCQ/wZLQ8KT/tHVc18vQWVThOJ9t/Evi1myEZBgMTW//s9E/9XJYX+8K1iVSw10OGWwSjzIWDUuHSVlpZXyC5fOxRCCQzHGE9BlM1+9cxwZiKIW3kqGFmLMAXhZaFHoobE0XEXx1Pbsak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j8fbIV/n; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="j8fbIV/n" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE558C4CEF0; Tue, 12 Aug 2025 17:42:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755020526; bh=L+d3EGMD+lStBTMrATB2cCMg6DRH9Z/bHwfMei3RUhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j8fbIV/nuhAvN63UU04S1tYCLp/NyTUrXhHFhrxlpN8SAFNL42MmWEeXtQipyNmNj /RC37EHQU2jAwGmYMg95igBzBJhQKRPFjB/qM+A/wyFj5C1ukCc09xy8WpJ7hG6kTU FE8Ci+VHtAYugC+oZopHWk7iVcG5ixIuWQzTk8V8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, "xin.guo" , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 107/253] tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range Date: Tue, 12 Aug 2025 19:28:15 +0200 Message-ID: <20250812172953.278583959@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812172948.675299901@linuxfoundation.org> References: <20250812172948.675299901@linuxfoundation.org> User-Agent: quilt/0.68 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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: xin.guo [ Upstream commit a041f70e573e185d5d5fdbba53f0db2fbe7257ad ] If the new coming segment covers more than one skbs in the ofo queue, and which seq is equal to rcv_nxt, then the sequence range that is duplicated will be sent as DUP SACK, the detail as below, in step6, the {501,2001} range is clearly including too much DUP SACK range, in violation of RFC 2883 rules. 1. client > server: Flags [.], seq 501:1001, ack 1325288529, win 20000, length 500 2. server > client: Flags [.], ack 1, [nop,nop,sack 1 {501:1001}], length 0 3. client > server: Flags [.], seq 1501:2001, ack 1325288529, win 20000, length 500 4. server > client: Flags [.], ack 1, [nop,nop,sack 2 {1501:2001} {501:1001}], length 0 5. client > server: Flags [.], seq 1:2001, ack 1325288529, win 20000, length 2000 6. server > client: Flags [.], ack 2001, [nop,nop,sack 1 {501:2001}], length 0 After this fix, the final ACK is as below: 6. server > client: Flags [.], ack 2001, options [nop,nop,sack 1 {501:1001}], length 0 [edumazet] added a new packetdrill test in the following patch. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: xin.guo Signed-off-by: Eric Dumazet Link: https://patch.msgid.link/20250626123420.1933835-2-edumazet@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 222b829f33f4..5ee1e1c2082c 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4834,8 +4834,9 @@ static void tcp_ofo_queue(struct sock *sk) if (before(TCP_SKB_CB(skb)->seq, dsack_high)) { __u32 dsack = dsack_high; + if (before(TCP_SKB_CB(skb)->end_seq, dsack_high)) - dsack_high = TCP_SKB_CB(skb)->end_seq; + dsack = TCP_SKB_CB(skb)->end_seq; tcp_dsack_extend(sk, TCP_SKB_CB(skb)->seq, dsack); } p = rb_next(p); -- 2.39.5