From: Jouni Malinen Date: Sat, 4 Oct 2014 19:11:00 +0000 (+0300) Subject: Fix authenticator OKC fetch from PMKSA cache to avoid infinite loop X-Git-Tag: hostap_2_3~28 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c829900bb01d6fb22e78ba78195c78de39f64b9;p=thirdparty%2Fhostap.git Fix authenticator OKC fetch from PMKSA cache to avoid infinite loop If the first entry in the PMKSA cache did not match the station's MAC address, an infinite loop could be reached in pmksa_cache_get_okc() when trying to find a PMKSA cache entry for opportunistic key caching cases. This would only happen if OKC is enabled (okc=1 included in the configuration file). Signed-off-by: Jouni Malinen --- diff --git a/src/ap/pmksa_cache_auth.c b/src/ap/pmksa_cache_auth.c index 4720b59c0..a7a292eaa 100644 --- a/src/ap/pmksa_cache_auth.c +++ b/src/ap/pmksa_cache_auth.c @@ -394,15 +394,13 @@ struct rsn_pmksa_cache_entry * pmksa_cache_get_okc( struct rsn_pmksa_cache_entry *entry; u8 new_pmkid[PMKID_LEN]; - entry = pmksa->pmksa; - while (entry) { + for (entry = pmksa->pmksa; entry; entry = entry->next) { if (os_memcmp(entry->spa, spa, ETH_ALEN) != 0) continue; rsn_pmkid(entry->pmk, entry->pmk_len, aa, spa, new_pmkid, wpa_key_mgmt_sha256(entry->akmp)); if (os_memcmp(new_pmkid, pmkid, PMKID_LEN) == 0) return entry; - entry = entry->next; } return NULL; }