From 7fb389e576cef5d8116aa055d4442d141efbb9cf Mon Sep 17 00:00:00 2001 From: Bala Venkatesh Date: Mon, 19 Aug 2019 17:58:11 +0530 Subject: [PATCH] qcacld-3.0: Check the p2p roc timer state by acquiring timer lock In function p2p_process_scan_complete_evt roc timer state is checked using the api qdf_mc_timer_get_current_state, this api does not take timer lock while returning the state. In other thread, if the timer state is changed then the wrong timer state is returned in current thread. And wrong timer state can lead to destroying roc timer without stopping it synchronously. Call qdf_timer_stop_sync api without checking the timer state as the timer already checking the state by taking a timer lock. Change-Id: Idb22e405178f2e0f1ed80b7c8aac04170e5b69bc CRs-Fixed: 2511768 --- components/p2p/core/src/wlan_p2p_roc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/components/p2p/core/src/wlan_p2p_roc.c b/components/p2p/core/src/wlan_p2p_roc.c index 16e304543af3..1a090e11f767 100644 --- a/components/p2p/core/src/wlan_p2p_roc.c +++ b/components/p2p/core/src/wlan_p2p_roc.c @@ -537,12 +537,10 @@ static QDF_STATUS p2p_process_scan_complete_evt( /* allow runtime suspend */ qdf_runtime_pm_allow_suspend(&p2p_soc_obj->roc_runtime_lock); - if (QDF_TIMER_STATE_RUNNING == - qdf_mc_timer_get_current_state(&roc_ctx->roc_timer)) { - status = qdf_mc_timer_stop_sync(&roc_ctx->roc_timer); - if (status != QDF_STATUS_SUCCESS) - p2p_err("Failed to stop roc timer"); - } + + status = qdf_mc_timer_stop_sync(&roc_ctx->roc_timer); + if (QDF_IS_STATUS_ERROR(status)) + p2p_err("Failed to stop roc timer"); status = qdf_mc_timer_destroy(&roc_ctx->roc_timer); if (status != QDF_STATUS_SUCCESS)