diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index e66e9f9fd0db..b91655a0d8f0 100644 --- a/net/mac80211/rc80211_minstrel_ht.c +++ b/net/mac80211/rc80211_minstrel_ht.c @@ -700,13 +700,17 @@ minstrel_get_sample_rate(struct minstrel_priv *mp, struct minstrel_ht_sta *mi) if (!mi->sample_tries) return -1; - mg = &mi->groups[mi->sample_group]; - sample_idx = sample_table[mg->column][mg->index]; - mr = &mg->rates[sample_idx]; sample_group = mi->sample_group; - sample_idx += sample_group * MCS_GROUP_RATES; + mg = &mi->groups[sample_group]; + sample_idx = sample_table[mg->column][mg->index]; minstrel_next_sample_idx(mi); + if (!(mg->supported & BIT(sample_idx))) + return -1; + + mr = &mg->rates[sample_idx]; + sample_idx += sample_group * MCS_GROUP_RATES; + /* * Sampling might add some overhead (RTS, no aggregation) * to the frame. Hence, don't use sampling for the currently