From 2d0bebc0854439ce92c29f7dba3e64fada435d8a Mon Sep 17 00:00:00 2001 From: Rahul Gusain Date: Thu, 9 Nov 2023 11:40:57 +0530 Subject: [PATCH] qcacld-3.0: Send crypto keys to target after SSR Currently, host driver receives the keys from the userspace and caches it in the VDEV object and then sends it to the target. But during SSR, driver destroys VDEV and hence keys are deleted. After SSR, driver need to send the keys again to the target as keys are destroyed from the target as well. But currently, keys are not available in the driver because keys are destroyed with VDEV deletion. So, to fix this, send crypto keys to target for SAP after SSR and clear the keys on SAP down. Change-Id: Icdfc93876ab79304b9dc96f9fce16553582a0d18 CRs-Fixed: 3663712 --- core/hdd/src/wlan_hdd_hostapd.c | 4 +++- core/hdd/src/wlan_hdd_main.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 778861a746..95e992a931 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1788,11 +1788,13 @@ static void hdd_hostapd_set_sap_key(struct hdd_adapter *adapter) struct wlan_crypto_key *crypto_key; uint8_t key_index; - for (key_index = 0; key_index < WLAN_CRYPTO_MAXKEYIDX; ++key_index) { + for (key_index = 0; key_index < WLAN_CRYPTO_TOTAL_KEYIDX; ++key_index) { crypto_key = wlan_crypto_get_key(adapter->deflink->vdev, key_index); if (!crypto_key) continue; + + hdd_debug("key idx %d", key_index); ucfg_crypto_set_key_req(adapter->deflink->vdev, crypto_key, WLAN_CRYPTO_KEY_TYPE_GROUP); wma_update_set_key(adapter->deflink->vdev_id, false, key_index, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 78f80d49ba..b8473f8946 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -250,6 +250,7 @@ #include "cdp_txrx_mon.h" #include "os_if_ll_sap.h" #include "wlan_p2p_ucfg_api.h" +#include "wlan_crypto_obj_mgr_i.h" #ifdef MULTI_CLIENT_LL_SUPPORT #define WLAM_WLM_HOST_DRIVER_PORT_ID 0xFFFFFF @@ -9719,6 +9720,7 @@ static void hdd_stop_sap_go_adapter(struct hdd_adapter *adapter) struct wlan_hdd_link_info *link_info = adapter->deflink; QDF_STATUS status = QDF_STATUS_SUCCESS; struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + uint8_t link_id; mode = adapter->device_mode; ap_ctx = WLAN_HDD_GET_AP_CTX_PTR(link_info); @@ -9790,6 +9792,13 @@ static void hdd_stop_sap_go_adapter(struct hdd_adapter *adapter) clear_bit(SOFTAP_INIT_DONE, &link_info->link_flags); qdf_mem_free(ap_ctx->beacon); ap_ctx->beacon = NULL; + + if (vdev) { + link_id = wlan_vdev_get_link_id(vdev); + ucfg_crypto_free_key_by_link_id(hdd_ctx->psoc, + &link_info->link_addr, + link_id); + } } /* Clear all the cached sta info */ hdd_clear_cached_sta_info(adapter); @@ -19725,6 +19734,9 @@ void hdd_component_psoc_close(struct wlan_objmgr_psoc *psoc) ucfg_fwol_psoc_close(psoc); ucfg_dlm_psoc_close(psoc); ucfg_mlme_psoc_close(psoc); + + if (!cds_is_driver_recovering()) + ucfg_crypto_flush_entries(psoc); } void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc)