aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHelmut Schaa <helmut.schaa@googlemail.com>2011-11-14 09:28:19 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-11-17 15:43:56 -0500
commitb79296beeba470074737a7d5a941f4ddd64863d8 (patch)
tree8dc3cac0d81d9036ed96832d538a3d1811135a51 /net
parenta7f23f0a8f6be9d95d8110d34b21ccce03111447 (diff)
mac80211: Check rate->idx before rate->count
The drivers are not required to fill in rate->count if rate->idx is set to -1. Hence, we should first check rate->idx before accessing rate->count. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Acked-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index cdb28535716b..972244f83c0d 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -300,10 +300,10 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
300static bool 300static bool
301minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate) 301minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate)
302{ 302{
303 if (!rate->count) 303 if (rate->idx < 0)
304 return false; 304 return false;
305 305
306 if (rate->idx < 0) 306 if (!rate->count)
307 return false; 307 return false;
308 308
309 return !!(rate->flags & IEEE80211_TX_RC_MCS); 309 return !!(rate->flags & IEEE80211_TX_RC_MCS);