Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2b85f42 authored by Pragaspathi Thilagaraj's avatar Pragaspathi Thilagaraj Committed by Madan Koyyalamudi
Browse files

qcacmn: Validate SSID first while fetching peer pmksa

Validate the SSID & cache ID if SSID length is present in the
pmksa entry, as in FILS case only SSID and cache id are filled
and BSSID is not filled.

So validate the BSSID only if the SSID is not present.

Change-Id: Ia0a31f953869f00495fad597bb564ec706425312
CRs-Fixed: 3051530
parent 92c8c2bb
Loading
Loading
Loading
Loading
+25 −13
Original line number Diff line number Diff line
@@ -370,7 +370,8 @@ QDF_STATUS wlan_crypto_set_pmksa(struct wlan_crypto_params *crypto_params,
		return QDF_STATUS_E_INVAL;
	}
	crypto_params->pmksa[first_available_slot] = pmksa;
	crypto_debug("PMKSA: Added the PMKSA entry at index=%d", i);
	crypto_debug("PMKSA: Added the PMKSA entry at index=%d",
		     first_available_slot);

	return QDF_STATUS_SUCCESS;
}
@@ -379,7 +380,7 @@ static
QDF_STATUS wlan_crypto_del_pmksa(struct wlan_crypto_params *crypto_params,
				 struct wlan_crypto_pmksa *pmksa)
{
	uint8_t i, j;
	uint8_t i, j, valid_entries_in_table = 0;
	bool match_found = false;
	u8 del_pmk[MAX_PMK_LEN] = {0};

@@ -387,7 +388,12 @@ QDF_STATUS wlan_crypto_del_pmksa(struct wlan_crypto_params *crypto_params,
	for (i = 0; i < WLAN_CRYPTO_MAX_PMKID; i++) {
		if (!crypto_params->pmksa[i])
			continue;
		if (qdf_is_macaddr_equal(&pmksa->bssid,

		valid_entries_in_table++;

		if (!pmksa->ssid_len &&
		    !qdf_is_macaddr_zero(&pmksa->bssid) &&
		    qdf_is_macaddr_equal(&pmksa->bssid,
					 &crypto_params->pmksa[i]->bssid)) {
			match_found = true;
		} else if (pmksa->ssid_len &&
@@ -435,7 +441,8 @@ QDF_STATUS wlan_crypto_del_pmksa(struct wlan_crypto_params *crypto_params,
	}

	if (i == WLAN_CRYPTO_MAX_PMKID && !match_found)
		crypto_debug("No such pmksa entry exists");
		crypto_debug("No such pmksa entry exists: valid entries:%d",
			     valid_entries_in_table);

	return QDF_STATUS_SUCCESS;
}
@@ -453,6 +460,8 @@ QDF_STATUS wlan_crypto_pmksa_flush(struct wlan_crypto_params *crypto_params)
		crypto_params->pmksa[i] = NULL;
	}

	crypto_debug("Flushed the pmksa table");

	return QDF_STATUS_SUCCESS;
}

@@ -607,10 +616,8 @@ wlan_crypto_get_peer_pmksa(struct wlan_objmgr_vdev *vdev,
	for (i = 0; i < WLAN_CRYPTO_MAX_PMKID; i++) {
		if (!crypto_params->pmksa[i])
			continue;
		if (qdf_is_macaddr_equal(&pmksa->bssid,
					 &crypto_params->pmksa[i]->bssid)) {
			return crypto_params->pmksa[i];
		} else if (pmksa->ssid_len &&

		if (pmksa->ssid_len &&
		    !qdf_mem_cmp(pmksa->ssid,
				 crypto_params->pmksa[i]->ssid,
				 pmksa->ssid_len) &&
@@ -618,6 +625,11 @@ wlan_crypto_get_peer_pmksa(struct wlan_objmgr_vdev *vdev,
				 crypto_params->pmksa[i]->cache_id,
				 WLAN_CACHE_ID_LEN)) {
			return crypto_params->pmksa[i];
		} else if (!pmksa->ssid_len &&
			   !qdf_is_macaddr_zero(&pmksa->bssid) &&
			   qdf_is_macaddr_equal(&pmksa->bssid,
					 &crypto_params->pmksa[i]->bssid)) {
			return crypto_params->pmksa[i];
		}
	}