From f28d06bb695000b4732d1d048414615dc28d31df Mon Sep 17 00:00:00 2001 From: Pragaspathi Thilagaraj Date: Thu, 6 May 2021 12:54:51 +0530 Subject: [PATCH] qcacld-3.0: Send update pmk cmd only if set/del pmksa is successful The WMI_PDEV_UPDATE_PMK_CACHE_CMDID command is sent even if the delete/set pmksa command fails due to same entry with same pmk already exists. This can cause invalid pmk entries to be updated in the Fw pmk table and also the host/fw pmksa table goes out of sync. To avoid this, send the WMI_PDEV_UPDATE_PMK_CACHE_CMDID command only if set pmksa/del pmksa is successful at crypto Change-Id: I080ebd9f6ca11bac216e6e8c62ef6060f0adef67 CRs-Fixed: 2937175 --- core/hdd/src/wlan_hdd_cfg80211.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index e4e13743197a..7e245482cad2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -22364,8 +22364,9 @@ static int __wlan_hdd_cfg80211_set_pmksa(struct wiphy *wiphy, TRACE_CODE_HDD_CFG80211_SET_PMKSA, adapter->vdev_id, result); - sme_set_del_pmkid_cache(hdd_ctx->psoc, adapter->vdev_id, - pmk_cache, true); + if (QDF_IS_STATUS_SUCCESS(result)) + sme_set_del_pmkid_cache(hdd_ctx->psoc, adapter->vdev_id, + pmk_cache, true); qdf_mem_zero(pmk_cache, sizeof(pmk_cache)); @@ -22415,6 +22416,7 @@ static int __wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, { struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + QDF_STATUS qdf_status = QDF_STATUS_E_FAILURE; int status = 0; tPmkidCacheInfo *pmk_cache; @@ -22451,23 +22453,24 @@ static int __wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy, hdd_fill_pmksa_info(adapter, pmk_cache, pmksa, true); - /* clear single_pmk_info information */ - sme_clear_sae_single_pmk_info(hdd_ctx->psoc,adapter->vdev_id, - pmk_cache); - /* Delete the PMKID CSR cache */ - if (QDF_STATUS_SUCCESS != - wlan_hdd_del_pmksa_cache(adapter, pmk_cache)) { + qdf_status = wlan_hdd_del_pmksa_cache(adapter, pmk_cache); + if (QDF_IS_STATUS_ERROR(qdf_status)) { if (!pmksa->bssid) hdd_err("Failed to delete PMKSA for null bssid"); else hdd_err("Failed to delete PMKSA for " QDF_MAC_ADDR_FMT, QDF_MAC_ADDR_REF(pmksa->bssid)); status = -EINVAL; - } + } else { + /* clear single_pmk_info information */ + sme_clear_sae_single_pmk_info(hdd_ctx->psoc, adapter->vdev_id, + pmk_cache); - sme_set_del_pmkid_cache(hdd_ctx->psoc, adapter->vdev_id, pmk_cache, - false); + /* Send the delete pmkid command to firmware */ + sme_set_del_pmkid_cache(hdd_ctx->psoc, adapter->vdev_id, + pmk_cache, false); + } qdf_mem_zero(pmk_cache, sizeof(*pmk_cache)); qdf_mem_free(pmk_cache);