diff mbox series

[18/34] wifi: iwlwifi: mvm: remove only link-specific AP keys

Message ID 20230329100039.e724878f502e.I66870d4629244b4b309be79e11cbbd384bdf93be@changeid
State New
Headers show
Series [01/34] wifi: iwlwifi: mvm: make some HW flags conditional | expand

Commit Message

Greenman, Gregory March 29, 2023, 7:05 a.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

When we remove the AP station, we iterate over the links
and remove all the keys, however, the key iteration will
return all keys for all links, so skip the ones that we
don't need based on the link ID.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c     | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c      | 9 +++++++--
 drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c | 2 +-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h          | 3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c          | 2 +-
 5 files changed, 12 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 1fd7e5bf594d..98c940271648 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -2722,7 +2722,7 @@  static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
 				      &mvm->status)) {
 				/* first remove remaining keys */
 				iwl_mvm_sec_key_remove_ap(mvm, vif,
-							  &mvmvif->deflink);
+							  &mvmvif->deflink, 0);
 
 				/*
 				 * Remove AP station now that
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
index 44206e3e1a87..f4785c0a0b84 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-key.c
@@ -195,6 +195,7 @@  static void iwl_mvm_sec_key_remove_ap_iter(struct ieee80211_hw *hw,
 					   void *data)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
+	unsigned int link_id = (uintptr_t)data;
 
 	if (key->hw_key_idx == STA_KEY_IDX_INVALID)
 		return;
@@ -202,13 +203,17 @@  static void iwl_mvm_sec_key_remove_ap_iter(struct ieee80211_hw *hw,
 	if (sta)
 		return;
 
+	if (key->link_id >= 0 && key->link_id != link_id)
+		return;
+
 	_iwl_mvm_sec_key_del(mvm, vif, NULL, key, CMD_ASYNC);
 	key->hw_key_idx = STA_KEY_IDX_INVALID;
 }
 
 void iwl_mvm_sec_key_remove_ap(struct iwl_mvm *mvm,
 			       struct ieee80211_vif *vif,
-			       struct iwl_mvm_vif_link_info *link)
+			       struct iwl_mvm_vif_link_info *link,
+			       unsigned int link_id)
 {
 	u32 sec_key_id = WIDE_ID(DATA_PATH_GROUP, SEC_KEY_CMD);
 	u8 sec_key_ver = iwl_fw_lookup_cmd_ver(mvm->fw, sec_key_id, 0);
@@ -222,5 +227,5 @@  void iwl_mvm_sec_key_remove_ap(struct iwl_mvm *mvm,
 
 	ieee80211_iter_keys_rcu(mvm->hw, vif,
 				iwl_mvm_sec_key_remove_ap_iter,
-				NULL);
+				(void *)(uintptr_t)link_id);
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
index e475d0daf512..1a97bf925817 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-mac80211.c
@@ -544,7 +544,7 @@  static void iwl_mvm_mld_vif_delete_all_stas(struct iwl_mvm *mvm,
 		if (!link)
 			continue;
 
-		iwl_mvm_sec_key_remove_ap(mvm, vif, link);
+		iwl_mvm_sec_key_remove_ap(mvm, vif, link, i);
 		ret = iwl_mvm_mld_rm_sta_id(mvm, vif, link->ap_sta_id);
 		if (ret)
 			IWL_ERR(mvm, "failed to remove AP station\n");
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index a7a7018edd2b..23d797247915 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2328,7 +2328,8 @@  int iwl_mvm_sec_key_del(struct iwl_mvm *mvm,
 			struct ieee80211_key_conf *keyconf);
 void iwl_mvm_sec_key_remove_ap(struct iwl_mvm *mvm,
 			       struct ieee80211_vif *vif,
-			       struct iwl_mvm_vif_link_info *link);
+			       struct iwl_mvm_vif_link_info *link,
+			       unsigned int link_id);
 
 int iwl_rfi_send_config_cmd(struct iwl_mvm *mvm,
 			    struct iwl_rfi_lut_entry *rfi_table);
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index f9f512a85ef1..9a3a7eabded8 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2022,7 +2022,7 @@  bool iwl_mvm_sta_del(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
 			return true;
 
 		/* first remove remaining keys */
-		iwl_mvm_sec_key_remove_ap(mvm, vif, &mvmvif->deflink);
+		iwl_mvm_sec_key_remove_ap(mvm, vif, &mvmvif->deflink, 0);
 
 		/* unassoc - go ahead - remove the AP STA now */
 		mvmvif->deflink.ap_sta_id = IWL_MVM_INVALID_STA;