Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2354302pxb; Mon, 20 Sep 2021 19:53:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhY9JQuMO08KFKvsKqMHEAwACTrzepNobJZta+TBVO+c15JcW1nNKZcfBVZnRnPfSoXTar X-Received: by 2002:a17:906:b14d:: with SMTP id bt13mr31475078ejb.39.1632192816199; Mon, 20 Sep 2021 19:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632192816; cv=none; d=google.com; s=arc-20160816; b=TVeu8grjaeQ/e7cFDbkk2bwl9amq6S8Qz/efyV7f1fOgJUSU2Ot5fFLf9As/k1UD46 qkzyiG5gvhU4nkuDQyM6neTvnZOiSyZLoFkiEacx74EJ7Hf/zJoBtm3xbrT6lhAvMfGV 4tAy47UkCYSxanjWWKp6dSnyrptWfN5lLrNQFnbO0m/2juEKUubEBv/ObOL6Dw+39EGX pDQbFig3QVQRLePBsKQNfgRsg9kJZFdJyvXxarSnUYckugDB3mP93L5RkCb2YbDqhDXn OIHjkKSTbz6Hawkee+pNC2/vCorYFS9LXxnh76avt/lNM5ul2JOGZX3KVJ5fZxaAYM1q ljBg== 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=LYkFw1nKqWI2P3rrcNoX0bPE0EiVIyFmyck385UXXF00cZQ3Bd1rXdlpwNtfFN31wx kCWCwnOi0JveZtXMIi0xrCwOneGcvIbP/axGmtvBoHtYHFKBh5uvohXmK/lgROe8jlEu SWR7RHeaUd5OjHrTeJ5ew2jiemM104k5YPeQEPyyAiOhsb3qDA4REzQBiEfIADqeqSLo V636PbaJD//zSInMRX6s6YJ9TGR+b68h/b63iDCBRIl98gEaUoNaCHsoPypwWFcCqI+y KCyM6nidgnSJqaFWwEFe5mrzDpqm7e1Cd7SIHdTB7xGKTq6pOxG2AmKVJijo6hJF7UjW OQpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="mDAWB2r/"; 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 k12si17933384edl.625.2021.09.20.19.53.12; Mon, 20 Sep 2021 19:53:36 -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="mDAWB2r/"; 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 S1348143AbhITSrh (ORCPT + 99 others); Mon, 20 Sep 2021 14:47:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:59834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383236AbhITSoR (ORCPT ); Mon, 20 Sep 2021 14:44:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D2C9B63356; Mon, 20 Sep 2021 17:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632159144; bh=KgqqFPEDo4wF7is/0aM+fQH4uN8YsFXo/LPDc+m1Sb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mDAWB2r/AIw+hjd7jyFUNVtJTXbq0yW1GAtMw16Eb4hoFCILdeLmB7x5MBVIcFWpf xgWouXDGwqQDODcjADl1E2GYI3mFLHm4oPSzCJzDsdoJCJgYXxFRev7E5Te79csRjS +BJ1xrnPk++zLUvNnyEmt7X175A2O/as32aTNrjI= 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.14 064/168] tcp: fix tp->undo_retrans accounting in tcp_sacktag_one() Date: Mon, 20 Sep 2021 18:43:22 +0200 Message-Id: <20210920163923.740602769@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163921.633181900@linuxfoundation.org> References: <20210920163921.633181900@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;