summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-02-05 17:53:52 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-04 10:26:17 +0100
commit5af224ab94863378920d3cbbb88a39cc0739fb2d (patch)
treea978f680a6f38e82d2e644d1bb393fb8951e631e /net
parentfef6f594ea434231d45b5df0dd1d9a8b38f7a9eb (diff)
downloadlinux-5af224ab94863378920d3cbbb88a39cc0739fb2d.tar.gz
linux-5af224ab94863378920d3cbbb88a39cc0739fb2d.tar.bz2
linux-5af224ab94863378920d3cbbb88a39cc0739fb2d.zip
mac80211: fix potential overflow when multiplying to u32 integers
[ 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 <colin.king@canonical.com> Link: https://lore.kernel.org/r/20210205175352.208841-1-colin.king@canonical.com Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mesh_hwmp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
index aa5150929996..b5b728a71ab5 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;
}