eb70d4d5d25932291d24d498a306b51a1b4c87d0
[openwrt/staging/adrian.git] /
1 From: Colin Ian King <colin.king@canonical.com>
2 Date: Thu, 22 Aug 2019 13:20:34 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: fix infinite loop because supported is
4 not being shifted
5
6 Currently the for-loop will spin forever if variable supported is
7 non-zero because supported is never changed. Fix this by adding in
8 the missing right shift of supported.
9
10 Addresses-Coverity: ("Infinite loop")
11 Fixes: 48cb39522a9d ("mac80211: minstrel_ht: improve rate probing for devices with static fallback")
12 Signed-off-by: Colin Ian King <colin.king@canonical.com>
13 ---
14
15 --- a/net/mac80211/rc80211_minstrel_ht.c
16 +++ b/net/mac80211/rc80211_minstrel_ht.c
17 @@ -634,7 +634,7 @@ minstrel_ht_rate_sample_switch(struct mi
18 u16 supported = mi->supported[g_idx];
19
20 supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES;
21 - for (i = 0; supported; i++) {
22 + for (i = 0; supported; supported >>= 1, i++) {
23 if (!(supported & 1))
24 continue;
25