wlan: Fixed below issues due to which 2nd client is not associating to
GO

1. eWNI_SME_UPPER_LAYER_ASSOC_CNF msg is only processed in
eCSR_ROAMING_STATE_JOINED state . When STA/GO is scanning CSR is in
eCSR_ROAMING_STATE_SCANNING state currently driver is not processing
eWNI_SME_UPPER_LAYER_ASSOC_CNF msg . Fixed this by processing this msg
in CSR scanning state as well.

2. In driver fix was done  to not  allow DEL_STA events based on
pAdapter->aStaInfo[i].isUsed flag in HDD

3. If Driver received deauth from p2p client and at the same time if
driver gets DEL_STA from supplicant. In this case after processing  the
over-the-air deauth frame driver has to remove  any pending sme commands
with same session ID, same peer mac addr and with reason code
eCsrForcedDeauthSta  For this csrRoamRemoveDuplicateCommand function
is enhanced to take care of this

4. Introduced a new variable deauth_in_progress in HDD to avoid further
DEL_STA events to driver even if supplicant is buggy

5. Abort_scan when SAP_ASSOC_EVENT  is received on GO

6.Fix an issue(SCAN busy) because of race condition between  disconnect
request from the HDD and deauth from AP

CR-Fixed:  436439
Change-Id: If847ddf412529ae51a1b1c6038663b7c2d67eb19
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index ca85655..da4fd77 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -6079,6 +6079,8 @@
                                          struct net_device *dev, u8 *mac)
 {
     hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+    VOS_STATUS vos_status;
+    v_U8_t staId;
 
     ENTER();
     if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
@@ -6127,13 +6129,52 @@
         }
         else
         {
+
+            vos_status = hdd_softap_GetStaId(pAdapter,(v_MACADDR_t *)mac, &staId);
+            if (!VOS_IS_STATUS_SUCCESS(vos_status))
+            {
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                                "%s: Skip this DEL STA as this is not used::"
+                                "%02x:%02x:%02x:%02x:%02x:%02x",
+                                __func__,
+                                mac[0], mac[1], mac[2],
+                                mac[3], mac[4], mac[5]);
+                return -ENOENT;
+            }
+
+            if( pAdapter->aStaInfo[staId].isDeauthInProgress == TRUE)
+            {
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                                "%s: Skip this DEL STA as deauth is in progress::"
+                                "%02x:%02x:%02x:%02x:%02x:%02x",
+                                __func__,
+                                mac[0], mac[1], mac[2],
+                                mac[3], mac[4], mac[5]);
+                return -ENOENT;
+            }
+
+            pAdapter->aStaInfo[staId].isDeauthInProgress = TRUE;
+
             hddLog(VOS_TRACE_LEVEL_INFO,
                                 "%s: Delete STA with MAC::"
                                 "%02x:%02x:%02x:%02x:%02x:%02x",
                                 __func__,
                                 mac[0], mac[1], mac[2],
                                 mac[3], mac[4], mac[5]);
-            hdd_softap_sta_deauth(pAdapter, mac);
+
+            vos_status = hdd_softap_sta_deauth(pAdapter, mac);
+            if (!VOS_IS_STATUS_SUCCESS(vos_status))
+            {
+                pAdapter->aStaInfo[staId].isDeauthInProgress = FALSE;
+                hddLog(VOS_TRACE_LEVEL_INFO,
+                                "%s: STA removal failed for ::"
+                                "%02x:%02x:%02x:%02x:%02x:%02x",
+                                __func__,
+                                mac[0], mac[1], mac[2],
+                                mac[3], mac[4], mac[5]);
+                return -ENOENT;
+            }
+
         }
     }