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/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 2c50a25..b401969 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -5515,6 +5515,7 @@
{
int status = 0;
hdd_wext_state_t *pWextState;
+ hdd_context_t *pHddCtx;
v_U32_t roamId;
tCsrRoamProfile *pRoamProfile;
eCsrAuthType RSNAuthType;
@@ -5522,6 +5523,15 @@
ENTER();
pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+ status = wlan_hdd_validate_context(pHddCtx);
+ if (status)
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid!", __func__);
+ return status;
+ }
if (SIR_MAC_MAX_SSID_LENGTH < ssid_len)
{
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 4d7f950..80e3039 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -1669,6 +1669,16 @@
)
{
int ret = 0;
+ hdd_context_t *pHddCtx;
+
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ ret = wlan_hdd_validate_context(pHddCtx);
+ if (ret)
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid!", __func__);
+ goto exit;
+ }
if (strncmp(command, "WLS_BATCHING VERSION", 20) == 0)
{