Skip to content

Commit

Permalink
mac80211: Check rate->idx before rate->count
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Helmut Schaa authored and John W. Linville committed Nov 17, 2011
1 parent a7f23f0 commit b79296b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/mac80211/rc80211_minstrel_ht.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
static bool
minstrel_ht_txstat_valid(struct ieee80211_tx_rate *rate)
{
if (!rate->count)
if (rate->idx < 0)
return false;

if (rate->idx < 0)
if (!rate->count)
return false;

return !!(rate->flags & IEEE80211_TX_RC_MCS);
Expand Down

0 comments on commit b79296b

Please sign in to comment.