Received: by 2002:a17:90a:9103:0:0:0:0 with SMTP id k3csp11793624pjo; Thu, 2 Jan 2020 14:23:09 -0800 (PST) X-Google-Smtp-Source: APXvYqzCfMRNBnF03zKogWeZtsVbYmbhU9g2G522Jf6Ek2jQPK95n3+WO7ktXHeMyT3lMazJSK/3 X-Received: by 2002:a05:6830:147:: with SMTP id j7mr96160301otp.44.1578003789282; Thu, 02 Jan 2020 14:23:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578003789; cv=none; d=google.com; s=arc-20160816; b=wDkvkBZ0YbcsOrWnMwOYzGkFvBd6yLwpt+x946dZL3xfFu8/7dtPz/NtyhFBXKLCwR 9CHBaX8jUOOo0tfBZukjFUdcfEYTslLjWnNQJf6Yri0zDtcoa4VdviLtybS17jyn0f2p Ai03iilu5J7Y07ZqGtqfRzuofJ6snzVukRxEnr9HGGWwnrIhrjTJO+D/IvW/zRE8CYK1 Fmk+PrxUw8TGULrd0hL/PZ/M+E8V0nrhGqGJzUAihV4GIj323/fhCgkg5xlTrQQDLMre Dy8+lFcUxnooT4CnlmvAbcjBXnjgVKPVDr4ly3lENtSxxfJdIu8fYxkt0DI8jjxjTSlT DVBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3o6gWlH6Az4E8aJ3c0tNa8GtuF0HTVi8iIUJIqpf+XA=; b=mfip7lHBHDPI0rUnllgOr28zXgjXZ1XpuRYDGbxvrk3Je187EQsJKR3uny0oXEncxn 60qoVXIEtMhgQHBX1yXF3gVPUFfpFd4Frf+E/RUIidYqvsWQYHo1NTsTONzCsLVdvEDG w/mEKbsCSVoIAg6zAH1av3UYzbPGx7Hf4PhS+89TswnjEaUkY3ZgpfXfqh5AJljI+Tvn WHs6XFrxQ+mwfoat+9LdgGMxxG43u/1omyb+8QGyzy2jnY41+QEhMWfubEt194BEwohl 2ameXkShGfCbGS8B4s/zHEr/4Lr1AY04/d0778vIRWpMWJiEu/mC2bEpE1hgwcXnxNbw du3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ViRX9ZtQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1si26520317oia.169.2020.01.02.14.22.57; Thu, 02 Jan 2020 14:23:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ViRX9ZtQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727325AbgABWWX (ORCPT + 99 others); Thu, 2 Jan 2020 17:22:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:42752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729131AbgABWWU (ORCPT ); Thu, 2 Jan 2020 17:22:20 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AB75321D7D; Thu, 2 Jan 2020 22:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578003740; bh=QCKbD5lsG3y8EzqeBjyyj/2nvanhz5ueWZviiPgGRrQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ViRX9ZtQbRDdVCmKFZCeA6oOxUj9ZMC/7UFLU1qXnGGxcizZ4/UXYxOss0ljht4Py 42aArmlIqJex4N4W2aliOtD6o+10Ln7hIvGDkKGrymQswnyfamwiypnDIOCVq7F3UH B/9PYr6YhUCjCApraTTp/VwhuGQX/6dak0YELhRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cambda Zhu , Eric Dumazet , "David S. Miller" Subject: [PATCH 4.19 094/114] tcp: Fix highest_sack and highest_sack_seq Date: Thu, 2 Jan 2020 23:07:46 +0100 Message-Id: <20200102220038.629285760@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200102220029.183913184@linuxfoundation.org> References: <20200102220029.183913184@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Cambda Zhu [ Upstream commit 853697504de043ff0bfd815bd3a64de1dce73dc7 ] >From commit 50895b9de1d3 ("tcp: highest_sack fix"), the logic about setting tp->highest_sack to the head of the send queue was removed. Of course the logic is error prone, but it is logical. Before we remove the pointer to the highest sack skb and use the seq instead, we need to set tp->highest_sack to NULL when there is no skb after the last sack, and then replace NULL with the real skb when new skb inserted into the rtx queue, because the NULL means the highest sack seq is tp->snd_nxt. If tp->highest_sack is NULL and new data sent, the next ACK with sack option will increase tp->reordering unexpectedly. This patch sets tp->highest_sack to the tail of the rtx queue if it's NULL and new data is sent. The patch keeps the rule that the highest_sack can only be maintained by sack processing, except for this only case. Fixes: 50895b9de1d3 ("tcp: highest_sack fix") Signed-off-by: Cambda Zhu Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_output.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -60,6 +60,9 @@ static void tcp_event_new_data_sent(stru __skb_unlink(skb, &sk->sk_write_queue); tcp_rbtree_insert(&sk->tcp_rtx_queue, skb); + if (tp->highest_sack == NULL) + tp->highest_sack = skb; + tp->packets_out += tcp_skb_pcount(skb); if (!prior_packets || icsk->icsk_pending == ICSK_TIME_LOSS_PROBE) tcp_rearm_rto(sk);