]> git.ipfire.org Git - thirdparty/openwrt.git/blob
f5d9d843f5797eb32ac5463a7aef3e9d0b529d0c
[thirdparty/openwrt.git] /
1 From 2a4b99ffcda9f6739d4deb7bd7d2e0ed8444dda7 Mon Sep 17 00:00:00 2001
2 From: Colin Ian King <colin.king@canonical.com>
3 Date: Fri, 5 Feb 2021 17:53:52 +0000
4 Subject: [PATCH] mac80211: fix potential overflow when multiplying to u32
5 integers
6
7 [ Upstream commit 6194f7e6473be78acdc5d03edd116944bdbb2c4e ]
8
9 The multiplication of the u32 variables tx_time and estimated_retx is
10 performed using a 32 bit multiplication and the result is stored in
11 a u64 result. This has a potential u32 overflow issue, so avoid this
12 by casting tx_time to a u64 to force a 64 bit multiply.
13
14 Addresses-Coverity: ("Unintentional integer overflow")
15 Fixes: 050ac52cbe1f ("mac80211: code for on-demand Hybrid Wireless Mesh Protocol")
16 Signed-off-by: Colin Ian King <colin.king@canonical.com>
17 Link: https://lore.kernel.org/r/20210205175352.208841-1-colin.king@canonical.com
18 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
19 Signed-off-by: Sasha Levin <sashal@kernel.org>
20 ---
21 net/mac80211/mesh_hwmp.c | 2 +-
22 1 file changed, 1 insertion(+), 1 deletion(-)
23
24 --- a/net/mac80211/mesh_hwmp.c
25 +++ b/net/mac80211/mesh_hwmp.c
26 @@ -355,7 +355,7 @@ static u32 airtime_link_metric_get(struc
27 */
28 tx_time = (device_constant + 10 * test_frame_len / rate);
29 estimated_retx = ((1 << (2 * ARITH_SHIFT)) / (s_unit - err));
30 - result = (tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
31 + result = ((u64)tx_time * estimated_retx) >> (2 * ARITH_SHIFT);
32 return (u32)result;
33 }
34