From 19caeb103e2566aa226a293e348e75803f4ea11f Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 10 Dec 2015 12:29:44 -0800 Subject: [PATCH] qcacld-3.0: Relocate init of tx_action_cnf_event HDD has a completion variable which is used to synchronize the sending of an action frame with the send confirmation. Proper use of a completion variable requires a specific sequence of steps: - Initialize the completion variable - Perform the activity that has asynchronous processing - Wait on the completion variable Currently HDD does not correctly follow this model for sending action frames; it incorrectly initializes the completion variable after it has invoked the UMAC function which sends the frame. This creates a race condition whereby the TX could complete and set the completion variable before the completion variable is initialized, and then when the completion variable is initialized the fact that the activity has already completed will be lost. In order to prevent this race condition and conform to the sequence of steps required for proper completion variable usage, relocate the initialization of tx_action_cnf_event. Change-Id: Ibc54b8dd62c3a828d1a43922d89e7970af325f6e CRs-Fixed: 950132 --- core/hdd/src/wlan_hdd_main.c | 1 - core/hdd/src/wlan_hdd_p2p.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e5e869948502..5d2bc52c46a6 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2057,7 +2057,6 @@ void hdd_cleanup_actionframe(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) if (NULL != cfgState->buf) { unsigned long rc; - INIT_COMPLETION(adapter->tx_action_cnf_event); rc = wait_for_completion_timeout( &adapter->tx_action_cnf_event, msecs_to_jiffies(ACTION_FRAME_TX_TIMEOUT)); diff --git a/core/hdd/src/wlan_hdd_p2p.c b/core/hdd/src/wlan_hdd_p2p.c index be647ad8272e..9018af87ba96 100644 --- a/core/hdd/src/wlan_hdd_p2p.c +++ b/core/hdd/src/wlan_hdd_p2p.c @@ -1544,6 +1544,8 @@ send_frame: current_freq = 0; } + INIT_COMPLETION(pAdapter->tx_action_cnf_event); + if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) || (WLAN_HDD_P2P_CLIENT == pAdapter->device_mode) || (WLAN_HDD_P2P_DEVICE == pAdapter->device_mode)