wlan: Avoid abort due to access of deinitialised socket

If driver initialization fails after nl initialization,
driver tries to stop PE by posting the message to MC
thread which in turn tries to send a message to the
ptt App, by this time the socket would have been
de-initialized due to which abort occurs.

Avoid sending any message during load unload in progress.
Reduce the min number of logging buffers to support low
memory devices and use vmalloc instead for logging buffer
allocation.

Change-Id: Ifdcd6ef0d92f0a68d03193070057a67818371674
CRs-Fixed: 652067
diff --git a/CORE/HDD/inc/wlan_hdd_cfg.h b/CORE/HDD/inc/wlan_hdd_cfg.h
index 055fd07..ad711ea 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg.h
@@ -2137,7 +2137,7 @@
 
 //Number of buffers to be used for WLAN logging
 #define CFG_WLAN_LOGGING_NUM_BUF_NAME     "wlanLoggingNumBuf"
-#define CFG_WLAN_LOGGING_NUM_BUF_MIN      ( 8  )
+#define CFG_WLAN_LOGGING_NUM_BUF_MIN      ( 4  )
 #define CFG_WLAN_LOGGING_NUM_BUF_MAX      ( 64 )
 #define CFG_WLAN_LOGGING_NUM_BUF_DEFAULT  ( 32 )
 #endif //WLAN_LOGGING_SOCK_SVC_ENABLE
diff --git a/CORE/SVC/src/logging/wlan_logging_sock_svc.c b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
index 7f28510..c687e0b 100644
--- a/CORE/SVC/src/logging/wlan_logging_sock_svc.c
+++ b/CORE/SVC/src/logging/wlan_logging_sock_svc.c
@@ -30,6 +30,7 @@
  *
  ******************************************************************************/
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE
+#include <vmalloc.h>
 #include <wlan_nlink_srv.h>
 #include <vos_status.h>
 #include <vos_trace.h>
@@ -490,7 +491,7 @@
 
 	gapp_pid = INVALID_PID;
 
-	gplog_msg = (struct log_msg *) vos_mem_malloc(
+	gplog_msg = (struct log_msg *) vmalloc(
 			num_buf * sizeof(struct log_msg));
 	if (!gplog_msg) {
 		pr_err("%s: Could not allocate memory\n", __func__);
@@ -548,7 +549,7 @@
 	wake_up_interruptible(&gwlan_logging.wait_queue);
 	wait_for_completion_interruptible(&gwlan_logging.shutdown_comp);
 
-	vos_mem_free(gplog_msg);
+	vfree(gplog_msg);
 
 	pr_info("%s: Deactivate wlan_logging svc\n", __func__);
 
diff --git a/CORE/VOSS/src/vos_diag.c b/CORE/VOSS/src/vos_diag.c
index cf0f809..5b41dc1 100644
--- a/CORE/VOSS/src/vos_diag.c
+++ b/CORE/VOSS/src/vos_diag.c
@@ -134,6 +134,13 @@
      /*Get the Hdd Context */
     pHddCtx = ((VosContextType*)(pVosContext))->pHDDContext;
 
+    if (WLAN_HDD_IS_LOAD_UNLOAD_IN_PROGRESS(pHddCtx))
+    {
+        VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_INFO,
+                  "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
+        return;
+    }
+
 #ifdef WLAN_KD_READY_NOTIFIER
     /* NL is not ready yet, WLAN KO started first */
     if ((pHddCtx->kd_nl_init) && (!pHddCtx->ptt_pid))