diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c b/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c index 1654f11ab8..974f3a374d 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_wpa3.c @@ -526,6 +526,11 @@ static void wpa3_process_rx_confirm(wpa3_hostap_auth_event_t *evt) goto done; } if (ret == WLAN_STATUS_SUCCESS) { + if (sta->sae_data && esp_send_sae_auth_reply(hapd, sta->addr, frm->bssid, WLAN_AUTH_SAE, 2, + WLAN_STATUS_SUCCESS, wpabuf_head(sta->sae_data), wpabuf_len(sta->sae_data)) != ESP_OK) { + ap_free_sta(hapd, sta); + goto done; + } if (esp_wifi_ap_notify_node_sae_auth_done(frm->bssid) != true) { ap_free_sta(hapd, sta); goto done; @@ -541,6 +546,10 @@ static void wpa3_process_rx_confirm(wpa3_hostap_auth_event_t *evt) } } done: + if (sta && sta->sae_data) { + wpabuf_free(sta->sae_data); + sta->sae_data = NULL; + } os_free(frm); } diff --git a/components/wpa_supplicant/src/ap/ieee802_11.c b/components/wpa_supplicant/src/ap/ieee802_11.c index 622d18fbea..7f73b1e386 100644 --- a/components/wpa_supplicant/src/ap/ieee802_11.c +++ b/components/wpa_supplicant/src/ap/ieee802_11.c @@ -180,13 +180,16 @@ static int auth_sae_send_confirm(struct hostapd_data *hapd, if (sta->remove_pending) { reply_res = -1; } else { - reply_res = esp_send_sae_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 2, - WLAN_STATUS_SUCCESS, wpabuf_head(data), - wpabuf_len(data)); + if (sta->sae_data) + wpabuf_free(data); + sta->sae_data = data; + reply_res = 0; + /* confirm is sent in later stage when all the required processing for a sta is done*/ } +#else + wpabuf_free(data); #endif /* ESP_SUPPLICANT */ - wpabuf_free(data); return reply_res; } diff --git a/components/wpa_supplicant/src/ap/sta_info.c b/components/wpa_supplicant/src/ap/sta_info.c index 66e856ebee..435843cef6 100644 --- a/components/wpa_supplicant/src/ap/sta_info.c +++ b/components/wpa_supplicant/src/ap/sta_info.c @@ -113,6 +113,10 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta) os_mutex_delete(sta->lock); sta->lock = NULL; } + if (sta->sae_data) { + wpabuf_free(sta->sae_data); + sta->sae_data = NULL; + } #endif /* CONFIG_SAE */ wpa_auth_sta_deinit(sta->wpa_sm); #ifdef CONFIG_WPS_REGISTRAR diff --git a/components/wpa_supplicant/src/ap/sta_info.h b/components/wpa_supplicant/src/ap/sta_info.h index af475d09c0..3c3769dd1a 100644 --- a/components/wpa_supplicant/src/ap/sta_info.h +++ b/components/wpa_supplicant/src/ap/sta_info.h @@ -66,6 +66,7 @@ struct sta_info { * processing commit for that station */ bool remove_pending; /* Flag to indicate to free station when * whose mutex is taken by task */ + struct wpabuf *sae_data; #endif /* CONFIG_SAE */ #endif /* ESP_SUPPLICANT */