Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp504605pxb; Wed, 3 Mar 2021 08:26:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLmyPM66vGp3SByNudh33VFZV1dZE5EW7BXaA6bMbnCSF6iMqjP2Erqe5U8K9AppsrI6/W X-Received: by 2002:a17:906:b2c3:: with SMTP id cf3mr25638691ejb.133.1614788780230; Wed, 03 Mar 2021 08:26:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614788780; cv=none; d=google.com; s=arc-20160816; b=XXsdso4xw4fU0gVkBTYNQYVKtw1i6YlLV+1aqc3a8Bz8mjMplZvQANj9kFSEDewoAP WZzwry7BcDg/3tyHq0NSRwMBKx3pk7iUIFLeZcnk1c/VSoVTzB5cDy/uQcv3KYhEGDD3 5SfpXzQtkz5mgSkx/ZLOEivKbp/U1klwPHgM/S+h3kUxlsIZan5j/GZSQ7Eshc3KKlyC H3e5cHWmB0MWn77/s02tFG8puqQBBcJ5ARMMRDmRGcLHoevOMVoMODOVQJPcNqIkHfx4 mKF6pgA16xKc4TaTZgzIyTPWcvbXLnfL5K9zdjRZpcrfXInIpLiqPndnoE5Od71KZmO9 /LbA== 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=k1qnKRlbyr9MfrmuIpR15tpTUVtC0XmPemuRPRJP66Y=; b=YG28Eo1i/7uVZ5UCR3fwsTJCk+P265zjG7wCSI84hg5K63GCH6CtIz0i6b+VqUuBwj pYDCcagMW9WRqfakTc/nx7qVrjyh1f5ZIsdbzlRxcr//ilAMU2RhyPGe1TPt6hA/zAwb nECsQxrEn7oOYrMEyBBA/zOshH0UKnhNo/IiDfaez9IV+Yes3LWBolt/9iIOEgJoGta2 oC/cRpZH0utZhUh8tsW7DcIM9j4vRqd+71oiCJjSXm0n522ZlzEiJCN52QkwHDkc2GHw caL8j+grpGSi61+ZF9FQR9i71//7j7baGxe7i++jQVrdPszjCZwc30WNellxMfcpREPi ZeOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hxQxxg1c; 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 a15si15779254edr.471.2021.03.03.08.25.26; Wed, 03 Mar 2021 08:26:20 -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=hxQxxg1c; 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 S1346789AbhCAXu1 (ORCPT + 99 others); Mon, 1 Mar 2021 18:50:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:34234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239367AbhCASL6 (ORCPT ); Mon, 1 Mar 2021 13:11:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22DC864F7C; Mon, 1 Mar 2021 17:08:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614618511; bh=sgpoTDeMHXbQua+lS2BnMkLkTPRZ47VR4rlXPMeXSvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hxQxxg1cpmAX4kVmZRyr0PeUtxyVR92HmiHZ/mTN+MvJC/yh7LY2ZVxlG8cipMlJB XScgaLg0XijaRqvbQWOUJ+E6kYbi/Ko5z3OsX2WIgkBsSdw5k5Bd28ednW5mERT9NT ZU/KDpTOLwKffF3WYMb7wQhczwRqMHwtlKkWBNKM= 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 5.10 114/663] mac80211: fix potential overflow when multiplying to u32 integers Date: Mon, 1 Mar 2021 17:06:02 +0100 Message-Id: <20210301161147.381865950@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161141.760350206@linuxfoundation.org> References: <20210301161141.760350206@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 313eee12410ec..3db514c4c63ab 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c @@ -356,7 +356,7 @@ 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