]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
iwlwifi: mvm: responder: allow to set only the HLTK for an associated station
authorAvraham Stern <avraham.stern@intel.com>
Wed, 30 Sep 2020 13:31:14 +0000 (16:31 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 1 Oct 2020 19:00:56 +0000 (22:00 +0300)
For secure ranging with an associated station, the driver only needs
to set the HLTK. There is no need to add an internal station for PMF
since the FW will use the existing station which already has the TK
installed.

Signed-off-by: Avraham Stern <avraham.stern@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200930161256.fcebaa5c9bc8.Ic584cc47fee717d0bdb43965798dbdf45d89910a@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/ftm-responder.c

index e940ef138f554e9c490141e4d44f452a5eaf6add..c794612c41d55035f9b5db455e826a3f86611a40 100644 (file)
@@ -322,7 +322,7 @@ int iwl_mvm_ftm_respoder_add_pasn_sta(struct iwl_mvm *mvm,
                                      u8 *hltk, u32 hltk_len)
 {
        int ret;
-       struct iwl_mvm_pasn_sta *sta;
+       struct iwl_mvm_pasn_sta *sta = NULL;
        struct iwl_mvm_pasn_hltk_data hltk_data = {
                .addr = addr,
                .hltk = hltk,
@@ -343,20 +343,23 @@ int iwl_mvm_ftm_respoder_add_pasn_sta(struct iwl_mvm *mvm,
                return -EINVAL;
        }
 
-       sta = kmalloc(sizeof(*sta), GFP_KERNEL);
-       if (!sta)
-               return -ENOBUFS;
+       if (tk && tk_len) {
+               sta = kzalloc(sizeof(*sta), GFP_KERNEL);
+               if (!sta)
+                       return -ENOBUFS;
 
-       ret = iwl_mvm_add_pasn_sta(mvm, vif, &sta->int_sta, addr, cipher, tk,
-                                  tk_len);
-       if (ret) {
-               kfree(sta);
-               return ret;
+               ret = iwl_mvm_add_pasn_sta(mvm, vif, &sta->int_sta, addr,
+                                          cipher, tk, tk_len);
+               if (ret) {
+                       kfree(sta);
+                       return ret;
+               }
        }
 
        ret = iwl_mvm_ftm_responder_dyn_cfg_v3(mvm, vif, NULL, &hltk_data);
        if (ret) {
-               iwl_mvm_resp_del_pasn_sta(mvm, vif, sta);
+               if (sta)
+                       iwl_mvm_resp_del_pasn_sta(mvm, vif, sta);
                return ret;
        }