Browse Source

qcacld-3.0: Fix invalid bssid filled while deleting pmksa

In delete pmksa call for FILS case, the userspace sends only the
ssid and cache id on the pmk cache. But the driver copies only the
bssid which could cause invalid bssid being copied and the delete
pmksa operation fails always.

Fill pmksa ssid if SSID and cache id are provided, else copy the
bssid. Also add additional debugs for FILS RSN IE.

Change-Id: I7836156e0fe4c885d35fd8791dfe3bf958a88522
CRs-Fixed: 3036327
Pragaspathi Thilagaraj 3 years ago
parent
commit
d8702a3159

+ 10 - 2
core/hdd/src/wlan_hdd_cfg80211.c

@@ -20509,7 +20509,16 @@ static QDF_STATUS wlan_hdd_del_pmksa_cache(struct hdd_adapter *adapter,
 	if (!vdev)
 		return QDF_STATUS_E_FAILURE;
 
-	qdf_copy_macaddr(&pmksa.bssid, &pmk_cache->bssid);
+	qdf_mem_zero(&pmksa, sizeof(pmksa));
+	if (!pmk_cache->ssid_len) {
+		qdf_copy_macaddr(&pmksa.bssid, &pmk_cache->bssid);
+	} else {
+		qdf_mem_copy(pmksa.ssid, pmk_cache->ssid, pmk_cache->ssid_len);
+		qdf_mem_copy(pmksa.cache_id, pmk_cache->cache_id,
+			     WLAN_CACHE_ID_LEN);
+		pmksa.ssid_len = pmk_cache->ssid_len;
+	}
+
 	result = wlan_crypto_set_del_pmksa(vdev, &pmksa, false);
 	hdd_objmgr_put_vdev_by_user(vdev, WLAN_OSIF_ID);
 
@@ -20792,7 +20801,6 @@ static int __wlan_hdd_cfg80211_del_pmksa(struct wiphy *wiphy,
 
 	hdd_fill_pmksa_info(adapter, pmk_cache, pmksa, true);
 
-
 	qdf_status = wlan_hdd_del_pmksa_cache(adapter, pmk_cache);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		if (!pmksa->bssid)

+ 2 - 2
core/mac/src/pe/lim/lim_process_fils.c

@@ -1540,13 +1540,13 @@ void lim_update_fils_config(struct mac_context *mac_ctx,
 			     fils_info->pmk_len);
 	}
 
-	pe_debug("FILS: fils=%d nai-len=%d rrk_len=%d akm=%d auth=%d pmk_len=%d",
+	pe_debug("FILS: fils=%d nai-len=%d rrk_len=%d akm=%d auth=%d pmk_len=%d rsn_len:%d",
 		 fils_info->is_fils_connection,
 		 fils_info->key_nai_length,
 		 fils_info->r_rk_length,
 		 fils_info->akm_type,
 		 fils_info->auth_type,
-		 fils_info->pmk_len);
+		 fils_info->pmk_len, pe_fils_info->rsn_ie_len);
 }
 
 #define EXTENDED_IE_HEADER_LEN 3

+ 7 - 1
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -3542,11 +3542,17 @@ lim_fill_rsn_ie(struct mac_context *mac_ctx, struct pe_session *session,
 		qdf_mem_copy(pmksa.cache_id,
 			     bss_desc->fils_info_element.cache_id,
 			     CACHE_ID_LEN);
-		qdf_mem_copy(&pmksa.bssid, session->bssId, QDF_MAC_ADDR_SIZE);
+		pe_debug("FILS: Cache id =0x%x 0x%x", pmksa.cache_id[0],
+			 pmksa.cache_id[1]);
 	} else {
 		qdf_mem_copy(&pmksa.bssid, session->bssId, QDF_MAC_ADDR_SIZE);
 	}
+
 	pmksa_peer = wlan_crypto_get_peer_pmksa(session->vdev, &pmksa);
+	if (!pmksa_peer)
+		pe_debug("FILS: vdev:%d Peer PMKSA not found ssid:%.*s cache_id_present:%d",
+			 session->vdev_id, pmksa.ssid_len, pmksa.ssid,
+			 bss_desc->fils_info_element.is_cache_id_present);
 
 	/* TODO: Add support for Adaptive 11r connection */
 	rsn_ie_end = wlan_crypto_build_rsnie_with_pmksa(session->vdev, rsn_ie,

+ 5 - 0
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -8472,6 +8472,11 @@ static void wlan_update_bss_with_fils_data(struct mac_context *mac_ctx,
 	qdf_mem_copy(bss_descr->fils_info_element.realm,
 			fils_ind->realm_identifier.realm,
 			bss_descr->fils_info_element.realm_cnt * SIR_REALM_LEN);
+	pe_debug("FILS: bssid:" QDF_MAC_ADDR_FMT "is_present:%d cache_id[0x%x%x]",
+		 QDF_MAC_ADDR_REF(bss_descr->bssId),
+		 fils_ind->cache_identifier.is_present,
+		 fils_ind->cache_identifier.identifier[0],
+		 fils_ind->cache_identifier.identifier[1]);
 	if (fils_ind->cache_identifier.is_present) {
 		bss_descr->fils_info_element.is_cache_id_present = true;
 		qdf_mem_copy(bss_descr->fils_info_element.cache_id,