From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34FCCC7618B for ; Fri, 26 Jul 2019 15:26:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F10F205F4 for ; Fri, 26 Jul 2019 15:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564154792; bh=bRoLmxs6UrpFTGvsosn43IKhXg9+P0mSc52KT5pUSxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=x1227h8rl+e0mTklaLPP7fCYtiMNMxsFy1ojfzUrj2R2G0vOZhL8iPCWNXVYeGkH8 JkMPOH16QRY76IWwqimXE07j7Qry1j2KbSlNDPcUEr2psIEK32zfU+kbHOtWiVwiBF LLV8bE0nF5oohdiTuStUZAU+urlRwE9rzpbecehA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387952AbfGZP0a (ORCPT ); Fri, 26 Jul 2019 11:26:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:40470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387939AbfGZP02 (ORCPT ); Fri, 26 Jul 2019 11:26:28 -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 68FD1205F4; Fri, 26 Jul 2019 15:26:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564154787; bh=bRoLmxs6UrpFTGvsosn43IKhXg9+P0mSc52KT5pUSxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpZqtJc23npW7Wfn9sP/yHM2caoE3Hq+WPMR99WpOoTmyDFSzfsvnvaadM+ZpB/+3 ctZ58VqrspqhS/Cil+/7IgdvgayosRI/tsTmcdCbGtG4QXh7DX0CRsyVTRKG1IYpAf SjArlA8p4PAlEmesPgFBriSeOzL2lWlx3NB5MOSk= 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 5.2 25/66] tcp: Reset bytes_acked and bytes_received when disconnecting Date: Fri, 26 Jul 2019 17:24:24 +0200 Message-Id: <20190726152304.549417424@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190726152301.936055394@linuxfoundation.org> References: <20190726152301.936055394@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -2614,6 +2614,8 @@ int tcp_disconnect(struct sock *sk, int tcp_saved_syn_free(tp); tp->compressed_ack = 0; tp->bytes_sent = 0; + tp->bytes_acked = 0; + tp->bytes_received = 0; tp->bytes_retrans = 0; tp->duplicate_sack[0].start_seq = 0; tp->duplicate_sack[0].end_seq = 0;