From 9d472c9da0a43140d7f2ee4d015b6af3d8343cb9 Mon Sep 17 00:00:00 2001 From: jiad Date: Fri, 28 Jul 2017 14:05:31 +0800 Subject: [PATCH] qcacld-3.0: fix possible race condition in hdd IPA hdd_ipa->sta_connected in WLAN_CLIENT_DISCONNECT case is not under lock protection and is prone to race conditions. Fix is to release event_lock after checking sta_connected so as to avoid possible race conditions. Change-Id: I6206d5d0cc2cf5df02ab4caf0de810961da21006 CRs-Fixed: 2082525 --- core/hdd/src/wlan_hdd_ipa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 85b24ff2cce3..d9fe1f0f8bf0 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -5983,14 +5983,16 @@ static int __hdd_ipa_wlan_evt(hdd_adapter_t *adapter, uint8_t sta_id, hdd_ipa_uc_handle_last_discon(hdd_ipa); } - qdf_mutex_release(&hdd_ipa->event_lock); - if (hdd_ipa_uc_sta_is_enabled(hdd_ipa->hdd_ctx) && - hdd_ipa->sta_connected) + hdd_ipa->sta_connected) { + qdf_mutex_release(&hdd_ipa->event_lock); hdd_ipa_uc_offload_enable_disable( hdd_get_adapter(hdd_ipa->hdd_ctx, QDF_STA_MODE), SIR_STA_RX_DATA_OFFLOAD, false); + } else { + qdf_mutex_release(&hdd_ipa->event_lock); + } } else { qdf_mutex_release(&hdd_ipa->event_lock); }