From e4e6c5b819deaff4c4c7cfd658ae8ef49c6612a1 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Thu, 22 Mar 2018 14:41:10 +0530 Subject: [PATCH] qcacld-3.0: Complete all wait events before shutdown There is a race condition between complete wait events as part of fw_down indication and wait for timeout of stop_bss_event during stop_ap. When stop ap and SSR runs parallel, first as part of SSR, fw_down indication comes and all the wait_events are getting set. After this as part of SAP stop, driver is waiting for stop_bss_event which will be never set as fw_down indication is already processed. Timeout of stop_bss_event is much higher than the timeout of wait-for-external- thread-completion during shutdown, hence shutdown will proceed without setting the stop_bss_event. Now as part of the SSR, hdd_re_init gets invoked and the memory of the hdd_hostapd_state (and as part of this memory of stop_bss_event) is getting memset inside hdd_init_ap_mode. After this memset the timeout of the stop_bss_event occurs and stop_bss_event tries to access this memset memory. To address this issue, all the events which were added in between fw_down indication and shutdown process, should be completed as part of the shutdown. Change-Id: I022f125b2afc99862351407b140f2d1b72f43bc4 CRs-Fixed: 2206326 --- core/hdd/src/wlan_hdd_driver_ops.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 003fb24d59fe..640b2dde1662 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -555,6 +555,18 @@ static void wlan_hdd_shutdown(void) hdd_err("Load/unload in progress, ignore SSR shutdown"); return; } + + /* + * Force Complete all the wait events before shutdown. + * This is done at "hdd_cleanup_on_fw_down" api also to clean up the + * wait events of north bound apis. + * In case of SSR there is significant dely between FW down event and + * wlan_hdd_shutdown, there is a possibility of race condition that + * these wait events gets complete at "hdd_cleanup_on_fw_down" and + * some new event is added before shutdown. + */ + qdf_complete_wait_events(); + /* this is for cases, where shutdown invoked from platform */ cds_set_recovery_in_progress(true); hdd_wlan_ssr_shutdown_event();