Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4341649ybi; Tue, 30 Jul 2019 00:16:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqy560t/IuuAi3+UuYt9g4Yrq3bsmPgMfB0yyq8QObyepKJMqRPuj0dgvZZdF93ul027ZQ3i X-Received: by 2002:a63:9c5:: with SMTP id 188mr72717565pgj.2.1564470963910; Tue, 30 Jul 2019 00:16:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564470963; cv=none; d=google.com; s=arc-20160816; b=MHCXGZwo/HSeGqNm+NHtgiF2J/OF2WANPJLiQaWIsYRKLDucRt/3ucAcPd2LLPefK4 8fgpfdhRLUBuHrZvQdUe1V5+FEW/IILWCrVa8EQ28EJ2L+IaG+BF1wYXNUlC0ZHcww9r 65eDwzh3GhOYrerDRdmJG3HmxkZ+nsdFqMGPgmD+3CE8s0PiqANkxXAIvHjFIEB8Avp/ fiN//LMxpo1shmbskcWMwAXLe5jv0oilQJnwRnB5UA1gQKyehbDvQVjpCMoAHAiBsTRz fmq6TzMfpcdCs48PqRmfy2BtIkWYxhws4PrWBIJmnwrSEAFDc04/ygwy5xNLiQAzcwpK 7Z0Q== 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=zs6gBDwcchdxjRV2Byxw4hqCVjCiKcxihvXBrdXdPPI=; b=SRj92z4FzdTUZsV7AUg7EgoSKcpfEtCCUnTBSbhjakXl8FJvfZnVbJMbB6siGwFjZy drheCnsQxbz5LohvAnABihaig0exi/FSw+l8UTBMflkPKMl9guTzjVXxIwIMkqs6boWH 6kPCwJG3/+l+nqsgrE2En8yGHR6hkwUbGYDkvRqNR6fQf7/ui2VAhWKsCSbjbMB/RZmq 43iWVPCiZrO52iBMahu04Pw+C5MOP6SVAKGKBTyAjWtWw86yY3f2mnvdcGYowU6sLhU5 pyl0Vj3BUKVh7k5IvceDTnSk6+v2E36w9LnqKQxfpivheGPSStyUjtIk0WwF6dtV7i8d Q2Og== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=unbBEz3l; 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 g5si25785685pjp.71.2019.07.30.00.15.48; Tue, 30 Jul 2019 00:16:03 -0700 (PDT) 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=unbBEz3l; 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 S1730471AbfG2ULF (ORCPT + 99 others); Mon, 29 Jul 2019 16:11:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:48214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387868AbfG2Tdw (ORCPT ); Mon, 29 Jul 2019 15:33:52 -0400 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 392A521773; Mon, 29 Jul 2019 19:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564428831; bh=12MB2UsBIr1bw8DUZkqPqk0bQzWqiWONwTykxzZqE1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unbBEz3lJakNUoWDw7g//8/bsmZtU9G4WO73AEIuD0vSKtG7Y8GgjAIg69Um/pKA/ PKmZT+groHnaDteYJt3vqektfWO3f4C7CyiDBaHjhU4bWSabLS+recFgyNv5N1VxoI 5Dh+xU5qPKIwWZxZAA1O4r1Ms/SvSN1o2r2PA/bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Christoph Paasch , "David S. Miller" Subject: [PATCH 4.14 201/293] tcp: Reset bytes_acked and bytes_received when disconnecting Date: Mon, 29 Jul 2019 21:21:32 +0200 Message-Id: <20190729190839.889480843@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190729190820.321094988@linuxfoundation.org> References: <20190729190820.321094988@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: Christoph Paasch [ Upstream commit e858faf556d4e14c750ba1e8852783c6f9520a0e ] If an app is playing tricks to reuse a socket via tcp_disconnect(), bytes_acked/received needs to be reset to 0. Otherwise tcp_info will report the sum of the current and the old connection.. Cc: Eric Dumazet Fixes: 0df48c26d841 ("tcp: add tcpi_bytes_acked to tcp_info") Fixes: bdd1f9edacb5 ("tcp: add tcpi_bytes_received to tcp_info") Signed-off-by: Christoph Paasch Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp.c | 2 ++ 1 file changed, 2 insertions(+) --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -2366,6 +2366,8 @@ int tcp_disconnect(struct sock *sk, int dst_release(sk->sk_rx_dst); sk->sk_rx_dst = NULL; tcp_saved_syn_free(tp); + tp->bytes_acked = 0; + tp->bytes_received = 0; /* Clean up fastopen related fields */ tcp_free_fastopen_req(tp);