Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1167256ybi; Fri, 2 Aug 2019 10:24:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyEqr6n7qGGVxEL1w7ayaqzS1dBK0kuV6PVKHDHDdziPE2ed8mXaa376afIiio0TRFJj+3x X-Received: by 2002:a63:f750:: with SMTP id f16mr96137778pgk.317.1564766668102; Fri, 02 Aug 2019 10:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564766668; cv=none; d=google.com; s=arc-20160816; b=ZDsrvQllkxESD2vTquX3m91OSFChqhhTwbp4P0UoKA7pdK5f1jq2THa/nWFVWBFwLO GNbRjqI8ntnLOGey1Oihpmfg3Lhysm2xA9bQfAMX0pJ3QDfLuspqtCS+oTtAfVFKnudG r5QHhVA7jmRVviPGVTHeaMZMGy0OvdlPcPqZSP2NjrXKbb9GnM9HK3FeMWQzlO7VO0og RIKrup/h5JpnB/q30MRMP+4lucKaMd7u1gHPvBSut/Lds97/WUx2m+4W6ZKBjPXPcYDQ 2z9Us88CeKkHqGndqsuuNjxP3lVGeZMO6sLWaBXZUWxQ1fHrNzHhF6KyDJq8hCUAncXj 9yaw== 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=NIHghg8N9Q5MrTpTJV+aDs398/WmS9uax5dVCSz3RNw=; b=RmZJTVtijCDg3Edv3oXrF7VMSTERzRmlEjUFc0LT09nhzm05LhhCvAosVOyrxYH2v8 jcfFqYUgxHKI5Oh+TSoMJeiVIGr62WaislrrH7k4GKu+y4qjtDjrGkwAEf/9knVsUsMu TKnt/Ee0aTFwnWGqWMtAfCXoGjlgCUU/R/dqj1ZYeAiVGMrxPfSlRizQdK41lROh7l5I chQx+j/wF90mpX+nX+u01rl/AtZgGtGv4WoqWn1LhDAmhFt4/QqSiDDCqNANN8MQZ58V 4UamXMmASOslci6EX5UHedbtquIIvD5eucRAd257OQEEjE42q/Vf9QATGZBvtbhO3oCv bcPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V5yky6al; 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 i21si27965773pgj.37.2019.08.02.10.24.12; Fri, 02 Aug 2019 10:24:28 -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=V5yky6al; 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 S2405613AbfHBJqx (ORCPT + 99 others); Fri, 2 Aug 2019 05:46:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:51386 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392071AbfHBJqs (ORCPT ); Fri, 2 Aug 2019 05:46:48 -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 0398C2086A; Fri, 2 Aug 2019 09:46:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564739208; bh=QnRODtU+IhQ9R5ywnjwo5VAXF8+yANFaGCE63gBLPss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5yky6alrmucaqX5P7ID953rcxLrx1gUgRdVuo7mJcnncYoaXlxSos1iXFpgZSAcm T/fIqtWvFxxKdTq+/ionSKBRTXCbwjKUubJUKJnuT/+6AT5806W3M3JZQ7Ss0VDQEN tU61AYQDA6addrV92u8w8AQ3uyrflPmat0yA7wOI= 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.9 147/223] tcp: Reset bytes_acked and bytes_received when disconnecting Date: Fri, 2 Aug 2019 11:36:12 +0200 Message-Id: <20190802092248.090760100@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190802092238.692035242@linuxfoundation.org> References: <20190802092238.692035242@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 @@ -2312,6 +2312,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; WARN_ON(inet->inet_num && !icsk->icsk_bind_hash);