Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3524989pxb; Mon, 1 Mar 2021 12:16:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw9Wga/clg0FiGX/EketxFMHehZyiEx/M6w4mkOUrJut9hTb8hXUK7EBKaOQSAxe4y+y/Sw X-Received: by 2002:a17:906:26c9:: with SMTP id u9mr18339174ejc.166.1614629810679; Mon, 01 Mar 2021 12:16:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614629810; cv=none; d=google.com; s=arc-20160816; b=DO3vfs+wx6Tsmthnr68quRqdmnEwmTOAAlRqZ0PqV2bl65gqeeUVYHn0PovJdLqv4Y etsF2ELc+zXIgxe+Qz090gRpJF449olpLooVIZP42supBJC9eobA/2jWZufvqXlPYV2U HGRmbpsz8VS31oHLh+GRDaN3ll14V+L1X4g4e9VXXba9omn3BgbAoN84AnGu2NvKeik/ ebwZ/EN2Vn9I2um6PtYXfl8Y+eO1qATvhJfoQkhY/1XB4EZPmdU7SCvbPhohuLm8z2W+ WVB65Cz5zKmxXPAvD/dCnXkwcvhJJ3zO1w45EeTNWA08xAOo3qPiWBL609QtspuG6NQ/ xOxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=G5kRhgxREiKsiLfElSd5JTtTWdiMxQXjqGHd0yXlqQs=; b=xWLw1gTx9qHuCePvLBn1tpP8iyKlGuSUBf/HuCTsgXxMLuXfJNsXgGZsKbbUqOLEGJ uEmq3pOUNwRuI08kqvKth8O6vOMWFtwOeC6B7q9tWtqmxqKEeGgzuGbJT3u3p2AG3hp3 myu703RDT1jpBcZIO3y0mqNv4lbBY98zLc09gfL1HsDIvj1NbKqspIM3UddY8Fux7MA/ 46rtyhXhzmKfn/4+qBMp9uA1mZ8axRN+3q8900HYVeiifzgk/MBPHRboO8QS4+ND26og 7OaDY+zmUGoaQmEy4y4unt//prfguLQzeti0rcVh6cx4eNiDlwOg3RsNC0DsmIxhKUdX MDow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FooPsWBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si11143478edx.226.2021.03.01.12.16.19; Mon, 01 Mar 2021 12:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FooPsWBF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243078AbhCAUNn (ORCPT + 99 others); Mon, 1 Mar 2021 15:13:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:59900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232292AbhCAREA (ORCPT ); Mon, 1 Mar 2021 12:04:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5248164F6B; Mon, 1 Mar 2021 16:39:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614616772; bh=Z4b2V/6q1F5NRoaIFhRTu6XdYCgovBEtkwPPrUXOSTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FooPsWBFBHUehuab1WSLn8PnaSofbpqimExXMTSBiTO6dh1XUDqUpbw/oLKTDZDdE pVHN/XJUkg27S5yjP1hWObgBE9rLR6X4ePQbw+x7NptULVwqK7AMB4s0XB3OvZvbwz HIdbWD617E/pC6pm6u9/dM8KkJWMDhJwmSb7XcwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Johannes Berg , Sasha Levin Subject: [PATCH 4.19 061/247] mac80211: fix potential overflow when multiplying to u32 integers Date: Mon, 1 Mar 2021 17:11:21 +0100 Message-Id: <20210301161034.652946361@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit 6194f7e6473be78acdc5d03edd116944bdbb2c4e ] The multiplication of the u32 variables tx_time and estimated_retx is performed using a 32 bit multiplication and the result is stored in a u64 result. This has a potential u32 overflow issue, so avoid this by casting tx_time to a u64 to force a 64 bit multiply. Addresses-Coverity: ("Unintentional integer overflow") Fixes: 050ac52cbe1f ("mac80211: code for on-demand Hybrid Wireless Mesh Protocol") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20210205175352.208841-1-colin.king@canonical.com Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mesh_hwmp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 6219b6b0c7e17..18158855d98c4 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -355,7 +355,7 @@ static u32 airtime_link_metric_get(struct ieee80211_local *local, */ tx_time = (device_constant + 10 * test_frame_len / rate); estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err)); - result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT); + result = ((u64)tx_time * estimated_retx) >> (2 * ARITH_SHIFT); return (u32)result; } -- 2.27.0