wlan: Avoid race condition between set PTK key and the EAPOL frames

DPU drops the EAPOL frame, because of race condition between the
set PTK key and the EAPOL frames. Avoiding the race condition by
making sure that the set key request is done only after upper layer
authentication is completed.

Change-Id: I60ca004d47e6cb87872b425656143aa8f634b5f1
CRs-Fixed: 578377
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 1163ce8..cede30c 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3511,6 +3511,20 @@
         pHostapdState = WLAN_HDD_GET_HOSTAP_STATE_PTR(pAdapter);
         if( pHostapdState->bssState == BSS_START )
         {
+            hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+            vos_status = wlan_hdd_check_ula_done(pAdapter);
+
+            if ( vos_status != VOS_STATUS_SUCCESS )
+            {
+                VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+                        "[%4d] wlan_hdd_check_ula_done returned ERROR status= %d",
+                        __LINE__, vos_status );
+
+                pHddStaCtx->roam_info.roamingState = HDD_ROAM_STATE_NONE;
+
+                return -EINVAL;
+            }
+
             status = WLANSAP_SetKeySta( pVosContext, &setKey);
 
             if ( status != eHAL_STATUS_SUCCESS )