mac80211: fix a deadlock in minstrel_ht when a HT client without valid MCS rates...
[openwrt/svn-archive/archive.git] / package / mac80211 / patches / 583-mac80211_fix_minstrel_ht_crash.patch
1 --- a/net/mac80211/rc80211_minstrel_ht.c
2 +++ b/net/mac80211/rc80211_minstrel_ht.c
3 @@ -634,18 +634,14 @@ minstrel_ht_update_caps(void *priv, stru
4 struct ieee80211_mcs_info *mcs = &sta->ht_cap.mcs;
5 struct ieee80211_local *local = hw_to_local(mp->hw);
6 u16 sta_cap = sta->ht_cap.cap;
7 + int n_supported = 0;
8 int ack_dur;
9 int stbc;
10 int i;
11
12 /* fall back to the old minstrel for legacy stations */
13 - if (!sta->ht_cap.ht_supported) {
14 - msp->is_ht = false;
15 - memset(&msp->legacy, 0, sizeof(msp->legacy));
16 - msp->legacy.r = msp->ratelist;
17 - msp->legacy.sample_table = msp->sample_table;
18 - return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
19 - }
20 + if (!sta->ht_cap.ht_supported)
21 + goto use_legacy;
22
23 BUILD_BUG_ON(ARRAY_SIZE(minstrel_mcs_groups) !=
24 MINSTREL_MAX_STREAMS * MINSTREL_STREAM_GROUPS);
25 @@ -700,7 +696,22 @@ minstrel_ht_update_caps(void *priv, stru
26
27 mi->groups[i].supported =
28 mcs->rx_mask[minstrel_mcs_groups[i].streams - 1];
29 +
30 + if (mi->groups[i].supported)
31 + n_supported++;
32 }
33 +
34 + if (!n_supported)
35 + goto use_legacy;
36 +
37 + return;
38 +
39 +use_legacy:
40 + msp->is_ht = false;
41 + memset(&msp->legacy, 0, sizeof(msp->legacy));
42 + msp->legacy.r = msp->ratelist;
43 + msp->legacy.sample_table = msp->sample_table;
44 + return mac80211_minstrel.rate_init(priv, sband, sta, &msp->legacy);
45 }
46
47 static void