Browse Source

qcacld-3.0: Fix a racing condition in BSS starting path

qcacld-2.0 to qcacld-3.0 propagation

1) BSS starting path and STA disassoc path should use
different events to perform synchronization
2) BSS starting event object should be reset before
BSS starting/restarting procedure is initiated

Change-Id: I96efd052fa19227c55c4f3af96afa8d590037c2d
CRs-Fixed: 1091108
Wei Song 8 years ago
parent
commit
2f76f64da7

+ 1 - 0
core/cds/src/cds_concurrency.c

@@ -6540,6 +6540,7 @@ void cds_restart_sap(hdd_adapter_t *ap_adapter)
 			goto end;
 		}
 
+		qdf_event_reset(&hostapd_state->qdf_event);
 		if (wlansap_start_bss(sap_ctx, hdd_hostapd_sap_event_cb,
 				      sap_config,
 				      ap_adapter->dev) != QDF_STATUS_SUCCESS) {

+ 1 - 0
core/hdd/inc/wlan_hdd_main.h

@@ -704,6 +704,7 @@ typedef struct hdd_hostapd_state_s {
 	int bssState;
 	qdf_event_t qdf_event;
 	qdf_event_t qdf_stop_bss_event;
+	qdf_event_t qdf_sta_disassoc_event;
 	QDF_STATUS qdf_status;
 	bool bCommit;
 

+ 4 - 4
core/hdd/src/wlan_hdd_cfg80211.c

@@ -13701,7 +13701,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 							DFS_CAC_IN_PROGRESS)
 						goto fn_end;
 
-					qdf_event_reset(&hapd_state->qdf_event);
+					qdf_event_reset(&hapd_state->qdf_sta_disassoc_event);
 					hdd_softap_sta_disassoc(pAdapter,
 								pDelStaParams);
 					qdf_status =
@@ -13712,7 +13712,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 						isDeauthInProgress = true;
 						qdf_status =
 							qdf_wait_single_event(
-								&hapd_state->qdf_event,
+								&hapd_state->qdf_sta_disassoc_event,
 								1000);
 						if (!QDF_IS_STATUS_SUCCESS(
 								qdf_status))
@@ -13760,7 +13760,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 			if (pHddCtx->dev_dfs_cac_status == DFS_CAC_IN_PROGRESS)
 				goto fn_end;
 
-			qdf_event_reset(&hapd_state->qdf_event);
+			qdf_event_reset(&hapd_state->qdf_sta_disassoc_event);
 			sme_send_disassoc_req_frame(WLAN_HDD_GET_HAL_CTX
 					(pAdapter), pAdapter->sessionId,
 					(uint8_t *)&pDelStaParams->peerMacAddr,
@@ -13776,7 +13776,7 @@ int __wlan_hdd_cfg80211_del_station(struct wiphy *wiphy,
 				return -ENOENT;
 			} else {
 				qdf_status = qdf_wait_single_event(
-							&hapd_state->qdf_event,
+							&hapd_state->qdf_sta_disassoc_event,
 							1000);
 				if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 					hdd_err("Deauth wait time expired");

+ 9 - 1
core/hdd/src/wlan_hdd_hostapd.c

@@ -1693,7 +1693,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		hdd_notice(" disassociated " MAC_ADDRESS_STR,
 		       MAC_ADDR_ARRAY(wrqu.addr.sa_data));
 
-		qdf_status = qdf_event_set(&pHostapdState->qdf_event);
+		qdf_status = qdf_event_set(&pHostapdState->qdf_sta_disassoc_event);
 		if (!QDF_IS_STATUS_SUCCESS(qdf_status))
 			hdd_err("ERR: Station Deauth event Set failed");
 
@@ -5845,6 +5845,14 @@ QDF_STATUS hdd_init_ap_mode(hdd_adapter_t *pAdapter)
 		goto error_init_ap_mode;
 	}
 
+	status = qdf_event_create(&phostapdBuf->qdf_sta_disassoc_event);
+	if (!QDF_IS_STATUS_SUCCESS(status)) {
+		hdd_err("ERROR: Hostapd HDD sta disassoc event init failed!!");
+		wlansap_close(sapContext);
+		pAdapter->sessionCtx.ap.sapContext = NULL;
+		return status;
+	}
+
 	init_completion(&pAdapter->session_close_comp_var);
 	init_completion(&pAdapter->session_open_comp_var);
 

+ 1 - 0
core/hdd/src/wlan_hdd_main.c

@@ -9008,6 +9008,7 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter)
 		goto end;
 	}
 
+	qdf_event_reset(&hostapd_state->qdf_event);
 	if (wlansap_start_bss(hdd_ap_ctx->sapContext, hdd_hostapd_sap_event_cb,
 			      &hdd_ap_ctx->sapConfig,
 			      ap_adapter->dev)