iwlwifi: mvm: check if returned value is NULL
authorSharon Dvir <sharon.dvir@intel.com>
Tue, 21 Feb 2017 08:41:31 +0000 (10:41 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 25 Apr 2017 12:17:58 +0000 (15:17 +0300)
While freeing inactive queue, check mvmsta to be valid before
dereferencing it.  Found by Klocwork.

Signed-off-by: Sharon Dvir <sharon.dvir@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sta.c

index a2a1fa06b78146344e6b723124acba53db955eb9..fc6d854b04b6f4de7b5842a96e911b0a1060b27b 100644 (file)
@@ -495,6 +495,8 @@ static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue,
        spin_unlock_bh(&mvm->queue_info_lock);
 
        mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id);
+       if (WARN_ON(!mvmsta))
+               return -EINVAL;
 
        disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue);
        /* Disable the queue */