summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorIlan Peer <ilan.peer@intel.com>2012-05-10 15:53:14 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-09 08:22:52 -0700
commitb7ad4aebc763c09f6792dae95c74fb289d76c641 (patch)
tree44573208b601c9d592bc3220f5eac6b9df046f33 /drivers
parentbd9f6140e697f52bdc7225d39a46c6b82d50cacc (diff)
iwlwifi: Check BSS ctx active before call mac80211
commit e19ebcab01cc130fa832764d453b263460ec3b91 upstream. It is possible that the BSS context is not active (for example when the current mode is set to GO), or that the vif->type is different than station. In such a case we cannot call mac80211 to report the average rssi for the interface (the function assumes that the vif is valid and that the type is station). Reported-by: Daniel J Blueman <daniel@quora.org> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Ilan Peer <ilan.peer@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-lib.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
index e55ec6c8a920..c31072d42791 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-lib.c
@@ -617,6 +617,11 @@ static bool iwlagn_fill_txpower_mode(struct iwl_priv *priv,
struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
int ave_rssi;
+ if (!ctx->vif || (ctx->vif->type != NL80211_IFTYPE_STATION)) {
+ IWL_DEBUG_INFO(priv, "BSS ctx not active or not in sta mode\n");
+ return false;
+ }
+
ave_rssi = ieee80211_ave_rssi(ctx->vif);
if (!ave_rssi) {
/* no rssi data, no changes to reduce tx power */