Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2563311lkm; Mon, 20 Sep 2021 18:48:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwvfTFA/bDVj8jY8DUAXqLVmY2EM8JbtUK3thSVUO66Sc1xzU5LXKeUiUx+u5cyy9KLZYg X-Received: by 2002:a6b:6908:: with SMTP id e8mr2498094ioc.51.1632188840999; Mon, 20 Sep 2021 18:47:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188840; cv=none; d=google.com; s=arc-20160816; b=Nv0zMd/L9jIVvfrykHIj5YqyII0zPlnrG4TwnfHZtAEMj2pT/+G9jRzUnzXBWbnVEA qmE5vTLiDPNcl6IPondl2HXcfkCvvotWfZ9+jOFv+uxDoVBw+HHEtFiaQT4M7o4hMQJe m/VbUy1h9PqDigeNvdu6DSxmw5eDZHRd7AP2rZTQXFaTDlOnUBZU1zy40WNirCTcsQSY 9ySuHwcWiqaa5rPsTsHi/oQpwv7QFy3Hu7ZGob13fo64njLySgrFSbNv4+rHCu7fhJ0G e8ho2Vt4HOKPr5Uf3HC9ZHF+QBFdMRpkd5HvA39OjeZFNwd4L+Wxy0SqkQGkumnVde4F M6Sg== 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=t619GjlarlnkQDG1xPwEKmMZ1np8HWpRVPmP5p1veE0=; b=02Xk7S/X6yPlYszEDYM6miQsI5+oP6MREv6NwtWRT1kdHyXjzA2JB+5NhbHUMG5gKI Gxw/Q4vJq0K7biiv4nBghHi17qXxXMza4AyL/L2Merz3r/xWHgSgOam2gtWppCLWldf3 qgdxG3Whc5/l22MVHI6uPmQcJixhVVd00WCsW22yQfyTgVSO45XSZlx96RDr1EaOt0/p mIdRaPWvMCCFcaHNJIN5HzEsz0+l3IuquoNtyBG+RKc6Ppfc95Z6qDXmAZ3sX+vxnH7J nR0zJ0kaAfXdTQMYrKPaum+OiHbUHSn/cBPkO6R1YuB/hT+A1r6LUU2VQtzSDiSLL2T+ bDyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z5eT17uj; 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 m3si9088670ilh.180.2021.09.20.18.47.09; Mon, 20 Sep 2021 18:47:20 -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=Z5eT17uj; 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 S1345688AbhITRcK (ORCPT + 99 others); Mon, 20 Sep 2021 13:32:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:34834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350573AbhITR3R (ORCPT ); Mon, 20 Sep 2021 13:29:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 389D561ABE; Mon, 20 Sep 2021 17:03:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157428; bh=CSoE8gAyB239BaM6q13G1oBHLiCAwDozt3nxcUbYb08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z5eT17ujzZUw2nP7BGlPnyEhslF+keCcVL0TC/jQ9iFbfan9G/E/AzxSSPjtmjnrD 67AX/PCIDeBVMTcc41PIefYZNUdZs2KxBH86C9KBsVfhSiIER0+4SbbJmq9Q0+Sdxi Gt1tM8Y9bq24Q+1ihMvLhMgpgsPfwNveCgiXPHTA= 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 4.14 203/217] tcp: fix tp->undo_retrans accounting in tcp_sacktag_one() Date: Mon, 20 Sep 2021 18:43:44 +0200 Message-Id: <20210920163931.504079663@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163924.591371269@linuxfoundation.org> References: <20210920163924.591371269@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 @@ -1225,7 +1225,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) state->reord = min(fack_count, state->reord); }