From 94516300005fd22914a522988f50b1f6b52c2108 Mon Sep 17 00:00:00 2001 From: jgujarathi Date: Wed, 12 Jul 2023 11:00:44 +0530 Subject: [PATCH] fix(wpa_supplicant) : Fix occasional crash during btm roam. Fix crash due to premature deallocation of neighbour report elements by scan_done. Post event to btm_rrm_t task to handle scan_done serially rather than when btm_rrm_t task is processing btm request rx frame. --- components/wpa_supplicant/src/esp_supplicant/esp_scan.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c index 4cac3b9f67..a947afd6df 100644 --- a/components/wpa_supplicant/src/esp_supplicant/esp_scan.c +++ b/components/wpa_supplicant/src/esp_supplicant/esp_scan.c @@ -30,6 +30,7 @@ #include "esp_supplicant/esp_common_i.h" #include "common/wnm_sta.h" #include "esp_scan_i.h" +#include "esp_common_i.h" extern struct wpa_supplicant g_wpa_supp; @@ -43,7 +44,13 @@ static void scan_done_event_handler(void *arg, STATUS status) wpa_s->type &= ~(1 << WLAN_FC_STYPE_BEACON) & ~(1 << WLAN_FC_STYPE_PROBE_RESP); esp_wifi_register_mgmt_frame_internal(wpa_s->type, wpa_s->subtype); } - esp_supplicant_handle_scan_done_evt(); +#ifdef CONFIG_SUPPLICANT_TASK + if (esp_supplicant_post_evt(SIG_SUPPLICANT_SCAN_DONE, 0) != 0) { + wpa_printf(MSG_ERROR, "Posting of scan done failed!"); + } +#else + esp_supplicant_handle_scan_done_evt(); +#endif /*CONFIG_SUPPLICANT_TASK*/ } static void esp_supp_handle_wnm_scan_done(struct wpa_supplicant *wpa_s)