wlan: WDI : Acquire lock before changing the WDI sate.

When WDI receives a response to a request, it checks for
any queued request and post a msg to VOS WDI queue,
to process this request. Before posting the msg, the WDI state
is changed to BUSY, while holding lock. When this msg is
processed the state is changed to STARTED without acquiring
any lock.

If any new request comes in between these state transition,
a situation may arise that the WDI state is set as BUSY
and no request is processed.

Protect the WDI state change with lock.

CRs-Fixed: 870763
Change-Id: I245518237b5b6ea0abc08c42347f4e6c3bd0e001
diff --git a/CORE/WDA/src/wlan_qct_wda.c b/CORE/WDA/src/wlan_qct_wda.c
index e9dd171..6fe3a71 100644
--- a/CORE/WDA/src/wlan_qct_wda.c
+++ b/CORE/WDA/src/wlan_qct_wda.c
@@ -17264,6 +17264,8 @@
 
 void WDA_FWLoggingDXEdoneInd(void)
 {
+   VOS_TRACE( VOS_MODULE_ID_WDA, VOS_TRACE_LEVEL_INFO,
+      " ----> %s", __func__ );
    WDI_FWLoggingDXEdoneInd(NULL);
 }
 
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index 0592a2a..430257e 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -22841,12 +22841,14 @@
     return;
   }
 
+  /*Access to the global state must be locked */
+  wpalMutexAcquire(&pWDICtx->wptMutex);
+
   /*Transition back to the state that we had before serialization
   - serialization transitions us to BUSY to stop any incomming requests
-  ! TO DO L: possible race condition here if a request comes in between the
-   state transition and the post function*/
-
+  */
   WDI_STATE_TRANSITION( pWDICtx, pMsg->val);
+  wpalMutexRelease(&pWDICtx->wptMutex);
 
   /*-----------------------------------------------------------------------
      Check to see what type of event we are serializing