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 422681C84C7; Tue, 12 Aug 2025 18:10:05 +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=1755022205; cv=none; b=Tx7C5r8Ev2jm2nQ3PT7CrpGOE2Q2YrJPbMSJJWKRrdUkENvLijCWdoTX1597Z9MtKnmiCy423xubtyTaENyWPCIUXOh2lQCR4gzug7/JJIrhK0Zj+YdN5MR9EGFjdg8wUVKoSSHWlYjVpVTC/foHlMG1JSbHut2fDOnUk9bTIxM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755022205; c=relaxed/simple; bh=jOzU52tJ11PkNm7ox1RjgVXtG7G3fJkDftvNoxcXVNc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b2yjcAZ1cXUdxkT5EUUPhIaliwLVG0xXsdzydvaW75bIwrQDthrusRWiJS41DTQIO/TIStpAoGqYLufuaeYSmf+q+KDk9XYM6E3MV5b+uV7anAhz2V0NSS19JuumgLcff1R2t7Fb8sQVucjgWnrCfI1LfE/2ktKLszCS0HKo7bg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=L7qtEkHm; 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="L7qtEkHm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5B2FC4CEF0; Tue, 12 Aug 2025 18:10:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755022205; bh=jOzU52tJ11PkNm7ox1RjgVXtG7G3fJkDftvNoxcXVNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L7qtEkHmW13p2OQaA6jRXlaZcqXMQGXayw5PIWkguyC6wdBWjM8L0uvyJcwS3mAHt AOk8CqMIZ7lqIZ8gBh+FlTiyCraiZpSR41jyEkWO3y+3gN04k50pMaRkmyOD+wAfbR 8OKCuvdaNk2kSAXYHGOqrwmUl7fRsrJzyhzicISs= 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.12 086/369] tcp: fix tcp_ofo_queue() to avoid including too much DUP SACK range Date: Tue, 12 Aug 2025 19:26:23 +0200 Message-ID: <20250812173018.017811362@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812173014.736537091@linuxfoundation.org> References: <20250812173014.736537091@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.12-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 d176e7888a20..d45a6dcc3753 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -4970,8 +4970,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