mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
wpa_supplicant: Correct task deletion for RRM and DPP tasks
Closes https://github.com/espressif/esp-idf/issues/7409
This commit is contained in:
parent
ab3f183f1c
commit
69e404e7b8
@ -304,9 +304,6 @@ void esp_supplicant_common_deinit(void)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = &g_wpa_supp;
|
||||
|
||||
if (esp_supplicant_post_evt(SIG_SUPPLICANT_DEL_TASK, 0) != 0) {
|
||||
wpa_printf(MSG_ERROR, "failed to send task delete event");
|
||||
}
|
||||
esp_scan_deinit(wpa_s);
|
||||
wpas_rrm_reset(wpa_s);
|
||||
wpas_clear_beacon_rep_data(wpa_s);
|
||||
@ -314,6 +311,12 @@ void esp_supplicant_common_deinit(void)
|
||||
&supplicant_sta_conn_handler);
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_STA_DISCONNECTED,
|
||||
&supplicant_sta_disconn_handler);
|
||||
wpa_s->type = 0;
|
||||
wpa_s->subtype = 0;
|
||||
esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype);
|
||||
if (esp_supplicant_post_evt(SIG_SUPPLICANT_DEL_TASK, 0) != 0) {
|
||||
wpa_printf(MSG_ERROR, "failed to send task delete event");
|
||||
}
|
||||
}
|
||||
|
||||
int esp_rrm_send_neighbor_rep_request(neighbor_rep_request_cb cb,
|
||||
@ -587,12 +590,19 @@ int esp_supplicant_post_evt(uint32_t evt_id, uint32_t data)
|
||||
evt->id = evt_id;
|
||||
evt->data = data;
|
||||
|
||||
SUPPLICANT_API_LOCK();
|
||||
/* Make sure lock exists before taking it */
|
||||
if (s_supplicant_api_lock) {
|
||||
SUPPLICANT_API_LOCK();
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
if (xQueueSend(s_supplicant_evt_queue, &evt, 10 / portTICK_PERIOD_MS ) != pdPASS) {
|
||||
SUPPLICANT_API_UNLOCK();
|
||||
os_free(evt);
|
||||
return -1;
|
||||
}
|
||||
SUPPLICANT_API_UNLOCK();
|
||||
if (evt_id != SIG_SUPPLICANT_DEL_TASK) {
|
||||
SUPPLICANT_API_UNLOCK();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -34,22 +34,36 @@ struct action_rx_param {
|
||||
|
||||
static int esp_dpp_post_evt(uint32_t evt_id, uint32_t data)
|
||||
{
|
||||
DPP_API_LOCK();
|
||||
|
||||
dpp_event_t *evt = os_zalloc(sizeof(dpp_event_t));
|
||||
int ret = ESP_OK;
|
||||
|
||||
if (evt == NULL) {
|
||||
DPP_API_UNLOCK();
|
||||
return ESP_ERR_NO_MEM;
|
||||
ret = ESP_ERR_NO_MEM;
|
||||
goto end;
|
||||
}
|
||||
evt->id = evt_id;
|
||||
evt->data = data;
|
||||
if ( xQueueSend(s_dpp_evt_queue, &evt, 10 / portTICK_PERIOD_MS ) != pdPASS) {
|
||||
DPP_API_UNLOCK();
|
||||
os_free(evt);
|
||||
return ESP_ERR_DPP_FAILURE;
|
||||
if (s_dpp_api_lock) {
|
||||
DPP_API_LOCK();
|
||||
} else {
|
||||
ret = ESP_ERR_DPP_FAILURE;
|
||||
goto end;
|
||||
}
|
||||
DPP_API_UNLOCK();
|
||||
return ESP_OK;
|
||||
if (xQueueSend(s_dpp_evt_queue, &evt, 10 / portTICK_PERIOD_MS ) != pdPASS) {
|
||||
DPP_API_UNLOCK();
|
||||
ret = ESP_ERR_DPP_FAILURE;
|
||||
goto end;
|
||||
}
|
||||
if (evt_id != SIG_DPP_DEL_TASK) {
|
||||
DPP_API_UNLOCK();
|
||||
}
|
||||
|
||||
return ret;
|
||||
end:
|
||||
if (evt) {
|
||||
os_free(evt);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void esp_dpp_call_cb(esp_supp_dpp_event_t evt, void *data)
|
||||
@ -653,6 +667,10 @@ void esp_supp_dpp_deinit(void)
|
||||
params->key = NULL;
|
||||
}
|
||||
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_ACTION_TX_STATUS,
|
||||
&offchan_event_handler);
|
||||
esp_event_handler_unregister(WIFI_EVENT, WIFI_EVENT_ROC_DONE,
|
||||
&offchan_event_handler);
|
||||
s_dpp_auth_retries = 0;
|
||||
dpp_global_deinit(s_dpp_ctx.dpp_global);
|
||||
esp_dpp_post_evt(SIG_DPP_DEL_TASK, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user