wlan: Prevent several functions to continue during SSR

Although wlan_hdd_cfg80211_connect_start() is called inside wlan_hdd
_cfg80211_connect() which is SSR protected, there is a chance that SSR
comes right after passing the check, so it should also be protected,
otherwise it may lead to a crash. The same protection is also made for
hdd_handle_batch_scan_ioctl() since it maybe invoked from IOCTL during
SSR.

Also add the NULL pointer check for potential crashes.

Change-Id: I25743da2e80b0362b3f55f7aaf4cbcfbd3bc8b35
CRs-fixed: 626282
(cherry picked from commit 4ed1478468df3b8a21749a4761872dbf2d197c57)
diff --git a/CORE/SME/src/sme_common/sme_Api.c b/CORE/SME/src/sme_common/sme_Api.c
index 3b2a3d1..4f7508f 100644
--- a/CORE/SME/src/sme_common/sme_Api.c
+++ b/CORE/SME/src/sme_common/sme_Api.c
@@ -2822,6 +2822,11 @@
     eHalStatus status = eHAL_STATUS_FAILURE;
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
 
+    if (!pMac)
+    {
+        return eHAL_STATUS_FAILURE;
+    }
+
     MTRACE(vos_trace(VOS_MODULE_ID_SME,
                    TRACE_CODE_SME_RX_HDD_MSG_CONNECT, sessionId, 0));
     smsLog(pMac, LOG2, FL("enter"));
@@ -10228,6 +10233,11 @@
     tpAniSirGlobal pMac = PMAC_STRUCT( hHal );
     eHalStatus status;
 
+    if (!pMac)
+    {
+        return eHAL_STATUS_FAILURE;
+    }
+
     if ( eHAL_STATUS_SUCCESS == ( status = sme_AcquireGlobalLock( &pMac->sme )))
     {
        status = pmcSetBatchScanReq(hHal, pRequest, sessionId, callbackRoutine,