Commit 6569e7d3 authored by Johannes Berg's avatar Johannes Berg

iwlwifi: fix locking in delayed GTK setting

This code clearly never could have worked, since it locks
while already locked. Add an unlocked __iwl_mvm_mac_set_key()
variant that doesn't do locking to fix that.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent abcbef59
...@@ -207,7 +207,7 @@ static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = { ...@@ -207,7 +207,7 @@ static const struct cfg80211_pmsr_capabilities iwl_mvm_pmsr_capa = {
}, },
}; };
static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
enum set_key_cmd cmd, enum set_key_cmd cmd,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
...@@ -2738,7 +2738,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw, ...@@ -2738,7 +2738,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
mvmvif->ap_early_keys[i] = NULL; mvmvif->ap_early_keys[i] = NULL;
ret = iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key); ret = __iwl_mvm_mac_set_key(hw, SET_KEY, vif, NULL, key);
if (ret) if (ret)
goto out_quota_failed; goto out_quota_failed;
} }
...@@ -3506,7 +3506,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw, ...@@ -3506,7 +3506,7 @@ static int iwl_mvm_mac_sched_scan_stop(struct ieee80211_hw *hw,
return ret; return ret;
} }
static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, static int __iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
enum set_key_cmd cmd, enum set_key_cmd cmd,
struct ieee80211_vif *vif, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct ieee80211_sta *sta,
...@@ -3565,8 +3565,6 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, ...@@ -3565,8 +3565,6 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
mutex_lock(&mvm->mutex);
switch (cmd) { switch (cmd) {
case SET_KEY: case SET_KEY:
if ((vif->type == NL80211_IFTYPE_ADHOC || if ((vif->type == NL80211_IFTYPE_ADHOC ||
...@@ -3712,7 +3710,22 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw, ...@@ -3712,7 +3710,22 @@ static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
ret = -EINVAL; ret = -EINVAL;
} }
return ret;
}
static int iwl_mvm_mac_set_key(struct ieee80211_hw *hw,
enum set_key_cmd cmd,
struct ieee80211_vif *vif,
struct ieee80211_sta *sta,
struct ieee80211_key_conf *key)
{
struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
int ret;
mutex_lock(&mvm->mutex);
ret = __iwl_mvm_mac_set_key(hw, cmd, vif, sta, key);
mutex_unlock(&mvm->mutex); mutex_unlock(&mvm->mutex);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment