Browse Source

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
jiad 7 years ago
parent
commit
9d472c9da0
1 changed files with 5 additions and 3 deletions
  1. 5 3
      core/hdd/src/wlan_hdd_ipa.c

+ 5 - 3
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);
 		}