Received: by 10.192.165.148 with SMTP id m20csp554562imm; Wed, 25 Apr 2018 04:10:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx49bd8d3NzZsCkMUyJtwVUIYJ0s0L0+Co64O5sKEuy+Cydvklv9y6yNX3+CKEqQtb8Cdmr6S X-Received: by 10.99.116.8 with SMTP id p8mr23129272pgc.327.1524654651632; Wed, 25 Apr 2018 04:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524654651; cv=none; d=google.com; s=arc-20160816; b=G987/pL8NWreB2bQCnqEWjm3rwDkHF47cqE2S9TLcUoKjH1kVzOzF20oVAJgpt0JyT tTs4AKU7Fl2VIojZnEQ+R2b3Yf3PC4/4sq4DJUP3utmH+5bQunCk+0ipE5sFzzVXUXxw iPiPpldbwOWpmS3rDorEkUnIV4koXAcsQh8enqzOl9J/Ver9DH3R11cZaYkhL4pNZV2Q 0Ld8qnWbCOCDu4LijNpHtxuWcV/oUflr/U2gKeGt7lMtaYYqvGRf8RoaKvm19B8s0sQ5 /U/WPu9Uu3pu3ttkQNoxyn4NFnq5Ql3v+xeg/QDw8AGOs7aKCRNyeyJw45BkQ8eVINJu HbXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cIlpWTopS+GpTeU1QMdyC0I+fB5wJf5ZiNbB0ueTdgs=; b=TbRGs6cngGYXwoUCqZ15zm+l4Xu9/H55s6DZ0b6qE0R+ZVxOeNbc4Z4jOcGVg9wxd8 1sC2X9SS7uj341GG8kmK17cyM6zelHY4aevFzf357zfg3AV2z3wqbUs30uWUaTNS2uk6 NBsrkdIBs+dJvtsaploi3he63U/7mCor0MTCSkEhpSodjFIik1kSMkaEH5QVQWBYB8kZ +UyMHsF0/jVdVTKyxUU/a5EBpLUFOeiTobZFptmjLz6k67I2Ogw0YA/ftEZtnI66IDst Kl9vnvKIX4ye5RdmWp690YrQf0DA4BrOCnWbdkl1DuIj4Kc5h1YQxY8G7FOJn4cFJ1wY h7WA== ARC-Authentication-Results: i=1; mx.google.com; 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 o69si15706384pfi.322.2018.04.25.04.10.37; Wed, 25 Apr 2018 04:10:51 -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; 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 S1754077AbeDYLJd (ORCPT + 99 others); Wed, 25 Apr 2018 07:09:33 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52378 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753971AbeDYKl0 (ORCPT ); Wed, 25 Apr 2018 06:41:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3973C480; Wed, 25 Apr 2018 10:41:25 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 104/183] tcp_nv: fix potential integer overflow in tcpnv_acked Date: Wed, 25 Apr 2018 12:35:24 +0200 Message-Id: <20180425103246.634702642@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "Gustavo A. R. Silva" [ Upstream commit e4823fbd229bfbba368b40cdadb8f4eeb20604cc ] Add suffix ULL to constant 80000 in order to avoid a potential integer overflow and give the compiler complete information about the proper arithmetic to use. Notice that this constant is used in a context that expects an expression of type u64. The current cast to u64 effectively applies to the whole expression as an argument of type u64 to be passed to div64_u64, but it does not prevent it from being evaluated using 32-bit arithmetic instead of 64-bit arithmetic. Also, once the expression is properly evaluated using 64-bit arithmentic, there is no need for the parentheses and the external cast to u64. Addresses-Coverity-ID: 1357588 ("Unintentional integer overflow") Signed-off-by: Gustavo A. R. Silva Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_nv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/tcp_nv.c +++ b/net/ipv4/tcp_nv.c @@ -327,7 +327,7 @@ static void tcpnv_acked(struct sock *sk, */ cwnd_by_slope = (u32) div64_u64(((u64)ca->nv_rtt_max_rate) * ca->nv_min_rtt, - (u64)(80000 * tp->mss_cache)); + 80000ULL * tp->mss_cache); max_win = cwnd_by_slope + nv_pad; /* If cwnd > max_win, decrease cwnd