prima: Resolve deadlock during random mac address generation

SME global lock is acquired before processing scan response
message in SME layer. As part of processing this scan response,
scan done callback is invoked in HDD layer which further tries
to acquire mac spoof lock to request new random mac address.
If hdd_processSpoofMacAddrRequest is invoked in kernel context
at the same time, there is possibility of deadlock as
hdd_processSpoofMacAddrRequest tries to acquire mac spoof lock
first and then sme global lock. If this sme global lock is already
acquired during scan done callback and waiting for mac spoof lock
before requesting for new random mac address, then there is possibility
of deadlock. Fix this by handling random mac address generation as
part of work queue so that sme global lock can be released immediately
without waiting for mac spoof lock.

Change-Id: I6b3b481b82e04d8e31eda6710905c16ec77e526f
CRs-Fixed: 936165
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index c3b2981..e934372 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -180,6 +180,8 @@
 #define MAC_ADDR_SPOOFING_FW_HOST_DISABLE           0
 #define MAC_ADDR_SPOOFING_FW_HOST_ENABLE            1
 #define MAC_ADDR_SPOOFING_FW_ENABLE_HOST_DISABLE    2
+#define MAC_ADDR_SPOOFING_DEFER_INTERVAL            10 //in ms
+
 
 static const u32 hdd_cipher_suites[] =
 {
@@ -5075,10 +5077,8 @@
             pHddCtx->spoofMacAddr.isEnabled = FALSE;
     }
 
-    if (VOS_STATUS_SUCCESS != hdd_processSpoofMacAddrRequest(pHddCtx))
-    {
-        hddLog(LOGE, FL("Failed to send Spoof Mac Addr to FW"));
-    }
+    schedule_delayed_work(&pHddCtx->spoof_mac_addr_work,
+                          msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL));
 
     EXIT();
     return 0;
@@ -12645,7 +12645,9 @@
          ||  pHddCtx->spoofMacAddr.isReqDeferred)) {
         /* Generate new random mac addr for next scan */
         hddLog(VOS_TRACE_LEVEL_INFO, "scan completed - generate new spoof mac addr");
-        hdd_processSpoofMacAddrRequest(pHddCtx);
+
+        schedule_delayed_work(&pHddCtx->spoof_mac_addr_work,
+                           msecs_to_jiffies(MAC_ADDR_SPOOFING_DEFER_INTERVAL));
     }
 
 allow_suspend: