From: Christian Lamparter Date: Sat, 16 Oct 2010 16:49:15 +0000 (+0200) Subject: mac80211: don't sanitize invalid rates X-Git-Tag: v2.6.35.10~194 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a171652459e33373b16fe9d48e200aaa359010b8;p=karo-tx-linux.git mac80211: don't sanitize invalid rates commit 5f4e6b2d3c74c1adda1cbfd9d9d30da22c7484fc upstream. I found this bug while poking around with a pure-gn AP. Commit: cfg80211/mac80211: Use more generic bitrate mask for rate control Added some sanity checks to ensure that each tx rate index is included in the configured mask and it would change any rate indexes if it wasn't. But, the current implementation doesn't take into account that the invalid rate index "-1" has a special meaning (= no further attempts) and it should not be "changed". Signed-off-by: Christian Lamparter Signed-off-by: John W. Linville Signed-off-by: Greg Kroah-Hartman Signed-off-by: Andi Kleen --- diff --git a/net/mac80211/rate.c b/net/mac80211/rate.c index 6d0bd198af19..68fc9c4e1537 100644 --- a/net/mac80211/rate.c +++ b/net/mac80211/rate.c @@ -326,6 +326,9 @@ void rate_control_get_rate(struct ieee80211_sub_if_data *sdata, * if needed. */ for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) { + /* Skip invalid rates */ + if (info->control.rates[i].idx < 0) + break; /* Rate masking supports only legacy rates for now */ if (info->control.rates[i].flags & IEEE80211_TX_RC_MCS) continue;