qcacmn: Do not delete/update old PMK entries if new PMK is same

Currently the PMKSA entries are deleted only if the BSSID matches
and will delete all the matching PMK cache entries even though
the new PMK is same as the existing PMK for the matched BSSID.
This results in unnecessary deletion/updation of PMKSA entries.

This change allows to check PMK as well along with BSSID. And if
the PMK doesn't match with existing matched BSSID entry then only
we delete the PMKSA entries.
This change fixes the below OKC scenario and avoids Full EAP:
Connect to AP1 -> Roam to AP2 -> Disconnect and Reconnect AP2 ->
Disconnect and Reconnect AP1.

Change-Id: Ic41c2044e70f8d375130ef9e0af9fe4b83027c26
CRs-Fixed: 2913686
This commit is contained in:
Srikanth Marepalli
2021-03-25 00:03:14 +05:30
committed by snandini
parent 23d574115e
commit 091a294bb3

View File

@@ -463,6 +463,7 @@ QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev,
QDF_STATUS status = QDF_STATUS_E_INVAL;
struct wlan_crypto_comp_priv *crypto_priv;
struct wlan_crypto_params *crypto_params;
struct wlan_crypto_pmksa *pmkid_cache = NULL;
enum QDF_OPMODE op_mode;
op_mode = wlan_vdev_mlme_get_opmode(vdev);
@@ -484,6 +485,19 @@ QDF_STATUS wlan_crypto_set_del_pmksa(struct wlan_objmgr_vdev *vdev,
crypto_params = &crypto_priv->crypto_params;
if (set) {
if (!pmksa->pmk_len || pmksa->pmk_len > MAX_PMK_LEN) {
crypto_err("Invalid PMK length");
return QDF_STATUS_E_FAILURE;
}
pmkid_cache = wlan_crypto_get_pmksa(vdev, &pmksa->bssid);
if (pmkid_cache && (!qdf_mem_cmp(pmkid_cache->pmk, pmksa->pmk,
pmksa->pmk_len))) {
crypto_debug("PMKSA entry found with same PMK");
pmkid_cache = NULL;
return QDF_STATUS_E_EXISTS;
}
status = wlan_crypto_set_pmksa(crypto_params, pmksa);
/* Set pmksa */
} else {
@@ -640,6 +654,7 @@ wlan_crypto_get_pmksa(struct wlan_objmgr_vdev *vdev, struct qdf_mac_addr *bssid)
continue;
if (qdf_is_macaddr_equal(bssid,
&crypto_params->pmksa[i]->bssid)) {
crypto_debug("PMKSA: Entry found at index %d", i);
return crypto_params->pmksa[i];
}
}