Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2351981pxb; Mon, 20 Sep 2021 19:48:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWUjI7C6QvKDmbRDU5ZDgOphQGpDJG74pQi2N4FZmqLyJgI70BdBuqWg1rD9thW2xMVuqU X-Received: by 2002:a05:6638:b10:: with SMTP id a16mr22638607jab.149.1632192518767; Mon, 20 Sep 2021 19:48:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192518; cv=none; d=google.com; s=arc-20160816; b=dgXNvyDtMZ2vge8B37oCkxo3fZ1aEbRP2CJS8ZzsiDXC5eBgxhJN679kmzysuYOm4o CfTddOH+sCIeIEAyyb6hCt5RxkTUE3eL7xRXDOgdDtWncFaiI/n86gR7vwY4VntX0GaH YJq2rGy0KsBxDqwcrM7sRjmzqi0j8KOpRKNfl/i30X+ve1Fz9DM71J7N8A9AtfbEDlf2 1bexdVVAQD2fJw0PiTBycoIcZ42WBVV1i/82/Ln9ERUev3cmG9aB27AhCpY5axWe9C4G TSZzdOuBChJ05xORpJSLFciOxCRp/zIxd9Z6rqEZcPyonpMg0i4cfMiPb7uV9+b6dSfn 3Y2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hmJ5/DYy0+0sf2rx0H/rzQb4ySg1QFt9tSTqNfsqwqE=; b=gbFESILxxk/BJSJP99zbMMh9d7CrYHKEpLK69nsIXUnXv1luYBLvOOTygjW3Zjum83 cfx8YkUbJG61/GbN7fMBcDVk9H2bzZmu9MLC4AEs5+rQX/9cVPIi0HqPW/ymp2/s3FX7 3v3ALhL2QGgdKA9hFqedQ1duIMIEXifRmqn8SaVEPOjZbFKvTX4LAdBlk3nWgeWf2AiN ftm+pP3VoQhBe2QUbI1QkGz8tx//pAiR58U+ARRXCM9jsC4e7TML44su4hBaSn2MSB0p O7jABhnKrQrQdBPr+QnSQYPS88JI/Hl5ikl3WELbwdYuLx9R1p6+xnJw9ARWOiA9XvNh KNeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hw9kHuf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h15si13433717jaa.28.2021.09.20.19.48.27; Mon, 20 Sep 2021 19:48:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hw9kHuf1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352871AbhITSdh (ORCPT + 99 others); Mon, 20 Sep 2021 14:33:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:48136 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378882AbhITS0y (ORCPT ); Mon, 20 Sep 2021 14:26:54 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B61DD632D9; Mon, 20 Sep 2021 17:25:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632158756; bh=KgqqFPEDo4wF7is/0aM+fQH4uN8YsFXo/LPDc+m1Sb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hw9kHuf1hAMI/ZKpIPLWRVasWJRe6xWuYEzglUDGuwWY752v+HqDg8anLVd5If3og KpT7o9a7vioB2ZS2LPEHxU7pbvYuJH/4vf98NUsAAkeeuwG4AoT1zOp2P8PrRpCBIx tJLDMW0MNIxCZCfxANtVnK5Rqw9+1sQ5MF6d+uxs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, zhenggy , Eric Dumazet , Yuchung Cheng , Neal Cardwell , "David S. Miller" Subject: [PATCH 5.10 042/122] tcp: fix tp->undo_retrans accounting in tcp_sacktag_one() Date: Mon, 20 Sep 2021 18:43:34 +0200 Message-Id: <20210920163917.166697668@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163915.757887582@linuxfoundation.org> References: <20210920163915.757887582@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: zhenggy commit 4f884f3962767877d7aabbc1ec124d2c307a4257 upstream. Commit 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time") may directly retrans a multiple segments TSO/GSO packet without split, Since this commit, we can no longer assume that a retransmitted packet is a single segment. This patch fixes the tp->undo_retrans accounting in tcp_sacktag_one() that use the actual segments(pcount) of the retransmitted packet. Before that commit (10d3be569243), the assumption underlying the tp->undo_retrans-- seems correct. Fixes: 10d3be569243 ("tcp-tso: do not split TSO packets at retransmit time") Signed-off-by: zhenggy Reviewed-by: Eric Dumazet Acked-by: Yuchung Cheng Acked-by: Neal Cardwell Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1314,7 +1314,7 @@ static u8 tcp_sacktag_one(struct sock *s if (dup_sack && (sacked & TCPCB_RETRANS)) { if (tp->undo_marker && tp->undo_retrans > 0 && after(end_seq, tp->undo_marker)) - tp->undo_retrans--; + tp->undo_retrans = max_t(int, 0, tp->undo_retrans - pcount); if ((sacked & TCPCB_SACKED_ACKED) && before(start_seq, state->reord)) state->reord = start_seq;