From: Helmut Schaa Date: Mon, 14 Nov 2011 14:28:19 +0000 (+0100) Subject: mac80211: Check rate->idx before rate->count X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b79296beeba470074737a7d5a941f4ddd64863d8;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Acked-by: Felix Fietkau Signed-off-by: John W. Linville --- diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c index cdb28535716..972244f83c0 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) 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);