diff options
author | Felix Fietkau <nbd@openwrt.org> | 2014-07-22 15:00:26 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2014-07-22 16:17:17 -0400 |
commit | fa8f136fe9a8fbdcb11a1db94f30146cae6d8777 (patch) | |
tree | 650a5ff1eb3b7b02f19ce8d652004f222a18d0a3 /net/mac80211 | |
parent | 8c26d458394be44e135d1c6bd4557e1c4e1a0535 (diff) |
mac80211: fix crash on getting sta info with uninitialized rate control
If the expected throughput is queried before rate control has been
initialized, the minstrel op for it will crash while trying to access
the rate table.
Check for WLAN_STA_RATE_CONTROL before attempting to use the rate
control op.
Reported-by: Jean-Pierre Tosoni <jp.tosoni@acksys.fr>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211')
-rw-r--r-- | net/mac80211/cfg.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index d7513a503be1..592f4b152ba8 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
@@ -472,12 +472,15 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) | |||
472 | { | 472 | { |
473 | struct ieee80211_sub_if_data *sdata = sta->sdata; | 473 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
474 | struct ieee80211_local *local = sdata->local; | 474 | struct ieee80211_local *local = sdata->local; |
475 | struct rate_control_ref *ref = local->rate_ctrl; | 475 | struct rate_control_ref *ref = NULL; |
476 | struct timespec uptime; | 476 | struct timespec uptime; |
477 | u64 packets = 0; | 477 | u64 packets = 0; |
478 | u32 thr = 0; | 478 | u32 thr = 0; |
479 | int i, ac; | 479 | int i, ac; |
480 | 480 | ||
481 | if (test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) | ||
482 | ref = local->rate_ctrl; | ||
483 | |||
481 | sinfo->generation = sdata->local->sta_generation; | 484 | sinfo->generation = sdata->local->sta_generation; |
482 | 485 | ||
483 | sinfo->filled = STATION_INFO_INACTIVE_TIME | | 486 | sinfo->filled = STATION_INFO_INACTIVE_TIME | |