diff options
author | Dennis Jeon <dennis.jeon@broadcom.corp-partner.google.com> | 2023-05-10 17:18:35 +0900 |
---|---|---|
committer | Isaac Chiou <isaacchiou@google.com> | 2023-09-12 04:51:49 +0000 |
commit | b6aef0956eeea5df2573f06b4754b8fbc575d71e (patch) | |
tree | 4b874a1cc00925b9e78571789e671dffa826454a | |
parent | 21e159afa782a11c269e8ca8e5c12826af05ac21 (diff) | |
download | wlan-b6aef0956eeea5df2573f06b4754b8fbc575d71e.tar.gz |
HAL: Fixed to invalidate global func ptr in clean_up routine
VendorHAL calls wifi_cleaned_up_handle late, giving LegacyHAL a chance to call a new API.
In current implementation, VendorHAL would not call wifi_cleaned_up_handle in wifi_clean_up context().
It defers calling it to another context.
wifi_cleaned_up_handle calls invalidate() and it makes global_handle_ as NULL.
so, it needs to be fixed to call cleaned_up_handler in cleanup routine instead of event_loop thread.
It will avoid incoming command from LegacyHAL after cleanup routine.
Bug: 280956926
Bug: 285834754
Test: Regression test
Change-Id: Ia12e37dc9bd5ce7041acdb38fbb10a29f1020857
Signed-off-by: Dennis Jeon <dennis.jeon@broadcom.corp-partner.google.com>
(cherry picked from commit b6309b2c53ae97883eee2f75194b816614698f86)
Merged-In: Ia12e37dc9bd5ce7041acdb38fbb10a29f1020857
-rw-r--r-- | bcmdhd/wifi_hal/wifi_hal.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bcmdhd/wifi_hal/wifi_hal.cpp b/bcmdhd/wifi_hal/wifi_hal.cpp index f746f09..f3039ca 100644 --- a/bcmdhd/wifi_hal/wifi_hal.cpp +++ b/bcmdhd/wifi_hal/wifi_hal.cpp @@ -608,7 +608,6 @@ static int wifi_add_membership(wifi_handle handle, const char *group) static void internal_cleaned_up_handler(wifi_handle handle) { hal_info *info = getHalInfo(handle); - wifi_cleaned_up_handler cleaned_up_handler = info->cleaned_up_handler; ALOGI("internal clean up"); @@ -622,12 +621,6 @@ static void internal_cleaned_up_handler(wifi_handle handle) info->event_sock = NULL; } - if (cleaned_up_handler) { - ALOGI("cleanup_handler cb"); - (*cleaned_up_handler)(handle); - } else { - ALOGI("!! clean up handler is null!!"); - } DestroyResponseLock(); pthread_mutex_destroy(&info->cb_lock); free(info); @@ -641,7 +634,7 @@ void wifi_internal_module_cleanup() twt_deinit_handler(); } -void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler) +void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler cleaned_up_handler) { if (!handle) { ALOGE("Handle is null"); @@ -655,8 +648,6 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler) wifi_interface_handle *ifaceHandles = NULL; wifi_interface_handle wlan0Handle; - info->cleaned_up_handler = handler; - wlan0Handle = wifi_get_wlan_interface((wifi_handle) info, ifaceHandles, numIfaceHandles); if (wlan0Handle != NULL) { @@ -728,6 +719,14 @@ void wifi_cleanup(wifi_handle handle, wifi_cleaned_up_handler handler) info->clean_up = true; + /* global func ptr be invalidated and will not call any command from legacy hal */ + if (cleaned_up_handler) { + ALOGI("cleaned_up_handler to invalidates func ptr"); + cleaned_up_handler(handle); + } else { + ALOGI("cleaned up handler is null"); + } + if (TEMP_FAILURE_RETRY(write(info->cleanup_socks[0], "Exit", 4)) < 1) { // As a fallback set the cleanup flag to TRUE ALOGE("could not write to the cleanup socket"); |