iwlwifi: mvm: Fix removal of IGTK
authorIlan Peer <ilan.peer@intel.com>
Mon, 16 Jan 2017 13:07:03 +0000 (15:07 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 8 Feb 2017 15:54:23 +0000 (17:54 +0200)
When removing an IGTK, iwl_mvm_send_sta_igtk() was
called before station ID was retrieved, so the function
was invoked with an invalid station ID. Fix this by first
getting the station ID.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=192411
Signed-off-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/sta.c

index 1bad933b3ad4ab2ac5596b8018490153b7dfde99..c35fabdf85da690871f658708a8e93f6348a45c1 100644 (file)
@@ -3047,6 +3047,11 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm,
 
        /* Get the station from the mvm local station table */
        mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta);
+       if (!mvm_sta) {
+               IWL_ERR(mvm, "Failed to find station\n");
+               return -EINVAL;
+       }
+       sta_id = mvm_sta->sta_id;
 
        IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n",
                      keyconf->keyidx, sta_id);
@@ -3074,8 +3079,6 @@ int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm,
                return 0;
        }
 
-       sta_id = mvm_sta->sta_id;
-
        ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast);
        if (ret)
                return ret;