From 4c2a9fe3ff09c70dcda6f975feac64635af62b46 Mon Sep 17 00:00:00 2001 From: Prakash Dhavali Date: Fri, 2 Dec 2016 16:01:08 -0800 Subject: [PATCH] qcacld-3.0: Fix out-of-order completion variable usage hdd_wlan_get_ibss_peer_info() and hdd_wlan_get_ibss_peer_info_all() initialize their completion variables after scheduling work, leading to a race condition that can cause the completion variable to be set before it is initialized. Reorder the operations so work is scheduled after initializing the completion variables. Change-Id: Ic773574f3620438b473cd5bcebee78ad87a37942 CRs-Fixed: 1074692 --- core/hdd/src/wlan_hdd_wext.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 91fadeb8e7df..73fd83072993 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -1243,11 +1243,10 @@ static QDF_STATUS hdd_wlan_get_ibss_peer_info(hdd_adapter_t *pAdapter, hdd_station_ctx_t *pStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; - status = - sme_request_ibss_peer_info(hHal, pAdapter, hdd_get_ibss_peer_info_cb, - false, staIdx); - INIT_COMPLETION(pAdapter->ibss_peer_info_comp); + status = sme_request_ibss_peer_info(hHal, pAdapter, + hdd_get_ibss_peer_info_cb, + false, staIdx); if (QDF_STATUS_SUCCESS == status) { unsigned long rc; @@ -1293,10 +1292,10 @@ static QDF_STATUS hdd_wlan_get_ibss_peer_info_all(hdd_adapter_t *pAdapter) tSirPeerInfoRspParams *pPeerInfo = &pStaCtx->ibss_peer_info; int i; - status = - sme_request_ibss_peer_info(hHal, pAdapter, hdd_get_ibss_peer_info_cb, - true, 0xFF); INIT_COMPLETION(pAdapter->ibss_peer_info_comp); + status = sme_request_ibss_peer_info(hHal, pAdapter, + hdd_get_ibss_peer_info_cb, + true, 0xFF); if (QDF_STATUS_SUCCESS == status) { unsigned long rc;