]> git.hungrycats.org Git - linux/commitdiff
mac80211: fix a crash in minstrel_ht in HT mode with no supported MCS rates
authorFelix Fietkau <nbd@openwrt.org>
Fri, 25 Mar 2011 14:30:38 +0000 (15:30 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:17 +0000 (13:02 -0700)
commit 4dc217df68a17a57f8464c74c1b4785e40bddf77 upstream.

When a client connects in HT mode but does not provide any valid MCS
rates, the function that finds the next sample rate gets stuck in an
infinite loop.
Fix this by falling back to legacy rates if no usable MCS rates are found.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/mac80211/rc80211_minstrel_ht.c

index 165a4518bb48eeae847fd8523829b26591cf44e7..cac35ff14b86e6d6b1fceda5f0933c12a5d31472 100644 (file)
@@ -639,18 +639,14 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
        struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
        struct ieee80211_local *local = hw_to_local(mp->hw);
        u16 sta_cap = sta->ht_cap.cap;
+       int n_supported = 0;
        int ack_dur;
        int stbc;
        int i;
 
        /* fall back to the old minstrel for legacy stations */
-       if (!sta->ht_cap.ht_supported) {
-               msp->is_ht = false;
-               memset(&msp->legacy, 0, sizeof(msp->legacy));
-               msp->legacy.r = msp->ratelist;
-               msp->legacy.sample_table = msp->sample_table;
-               return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
-       }
+       if (!sta->ht_cap.ht_supported)
+               goto use_legacy;
 
        BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
                MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
@@ -705,7 +701,22 @@ minstrel_ht_update_caps(void *priv, struct ieee80211_supported_band *sband,
 
                mi->groups[i].supported =
                        mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
+
+               if (mi->groups[i].supported)
+                       n_supported++;
        }
+
+       if (!n_supported)
+               goto use_legacy;
+
+       return;
+
+use_legacy:
+       msp->is_ht = false;
+       memset(&msp->legacy, 0, sizeof(msp->legacy));
+       msp->legacy.r = msp->ratelist;
+       msp->legacy.sample_table = msp->sample_table;
+       return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
 }
 
 static void