iwlwifi: mvm: fix theoretical NULL ptr dereference
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Mar 2014 12:53:18 +0000 (14:53 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Mar 2014 19:15:40 +0000 (21:15 +0200)
mvmsta could have been NULL / ERR.

Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/debugfs-vif.c

index f64e972191eb567f3fdf7cb94072237a8c0f1d7d..9b59e1d7ae71ea888973992cb88363ba2371fdad 100644 (file)
@@ -312,6 +312,11 @@ static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif,
        mutex_lock(&mvm->mutex);
 
        mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);
+       if (IS_ERR_OR_NULL(mvmsta)) {
+               mutex_unlock(&mvm->mutex);
+               return -ENOTCONN;
+       }
+
        mvmsta->bt_reduced_txpower_dbg = false;
        ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
                                          reduced_tx_power);