mac80211: fix a regression in the minstrel_ht improvement patches
authorFelix Fietkau <nbd@nbd.name>
Sat, 24 Aug 2019 10:41:19 +0000 (12:41 +0200)
committerFelix Fietkau <nbd@nbd.name>
Sat, 24 Aug 2019 10:47:00 +0000 (12:47 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch [new file with mode: 0644]

diff --git a/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch b/package/kernel/mac80211/patches/subsys/315-mac80211-minstrel_ht-fix-infinite-loop-because-suppo.patch
new file mode 100644 (file)
index 0000000..eb70d4d
--- /dev/null
@@ -0,0 +1,25 @@
+From: Colin Ian King <colin.king@canonical.com>
+Date: Thu, 22 Aug 2019 13:20:34 +0100
+Subject: [PATCH] mac80211: minstrel_ht: fix infinite loop because supported is
+ not being shifted
+
+Currently the for-loop will spin forever if variable supported is
+non-zero because supported is never changed.  Fix this by adding in
+the missing right shift of supported.
+
+Addresses-Coverity: ("Infinite loop")
+Fixes: 48cb39522a9d ("mac80211: minstrel_ht: improve rate probing for devices with static fallback")
+Signed-off-by: Colin Ian King <colin.king@canonical.com>
+---
+
+--- a/net/mac80211/rc80211_minstrel_ht.c
++++ b/net/mac80211/rc80211_minstrel_ht.c
+@@ -634,7 +634,7 @@ minstrel_ht_rate_sample_switch(struct mi
+               u16 supported = mi->supported[g_idx];
+               supported >>= mi->max_tp_rate[0] % MCS_GROUP_RATES;
+-              for (i = 0; supported; i++) {
++              for (i = 0; supported; supported >>= 1, i++) {
+                       if (!(supported & 1))
+                               continue;