wlan: Avoid kernel panic during change interface
Check isLoadUnloadInProgress flag during change interface.
Move all the context related check into common function and
call this function for all cfg80211 ops.
Change-Id: Ib3b26f11ecef1dfb9324817ef8fcf52d20162e1d
CRs-fixed: 490340
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 2487bf2..f61c1f8 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1074,4 +1074,5 @@
void hdd_exchange_version_and_caps(hdd_context_t *pHddCtx);
void hdd_set_pwrparams(hdd_context_t *pHddCtx);
void hdd_reset_pwrparams(hdd_context_t *pHddCtx);
+int wlan_hdd_validate_context(hdd_context_t *pHddCtx);
#endif // end #if !defined( WLAN_HDD_MAIN_H )
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 519f25e..d77afe1 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -1483,6 +1483,8 @@
int channel = 0;
hdd_adapter_t *pAdapter = NULL;
int freq = chan->center_freq; /* freq is in MHZ */
+ hdd_context_t *pHddCtx;
+ int status;
ENTER();
@@ -1497,10 +1499,15 @@
hddLog(VOS_TRACE_LEVEL_INFO,
"%s: device_mode = %d freq = %d \n",__func__,
pAdapter->device_mode, chan->center_freq);
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
/*
@@ -1607,7 +1614,7 @@
return -EINVAL;
}
EXIT();
- return 0;
+ return status;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
@@ -2024,17 +2031,21 @@
struct beacon_parameters *params)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
- int status=VOS_STATUS_SUCCESS;
+ hdd_context_t *pHddCtx;
+ int status;
ENTER();
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "device mode=%d\n",pAdapter->device_mode);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ( (pAdapter->device_mode == WLAN_HDD_SOFTAP)
@@ -2071,18 +2082,22 @@
struct beacon_parameters *params)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
- int status=VOS_STATUS_SUCCESS;
+ hdd_context_t *pHddCtx;
+ int status;
ENTER();
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
__func__,pAdapter->device_mode);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
@@ -2127,7 +2142,7 @@
hdd_context_t *pHddCtx = NULL;
hdd_scaninfo_t *pScanInfo = NULL;
hdd_adapter_t *staAdapter = NULL;
- VOS_STATUS status = 0;
+ VOS_STATUS status;
ENTER();
@@ -2138,18 +2153,14 @@
return -ENODEV;
}
- pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
- if (NULL == pHddCtx)
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: HDD context is Null", __func__);
- return -ENODEV;
- }
- if (pHddCtx->isLogpInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_INFRA_STATION);
@@ -2158,7 +2169,7 @@
staAdapter = hdd_get_adapter(pAdapter->pHddCtx, WLAN_HDD_P2P_CLIENT);
if (NULL == staAdapter)
{
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: HDD adapter context is Null", __func__);
return -ENODEV;
}
@@ -2166,14 +2177,6 @@
pScanInfo = &pHddCtx->scan_info;
- if (pHddCtx->isLogpInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
- return -EAGAIN;
- }
-
- pHddCtx = (hdd_context_t*)pAdapter->pHddCtx;
-
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
__func__,pAdapter->device_mode);
@@ -2277,13 +2280,13 @@
{
hdd_adapter_t *pAdapter;
hdd_context_t *pHddCtx;
- int status = 0;
+ int status;
ENTER();
if (NULL == dev)
{
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: Device is Null", __func__);
return -ENODEV;
}
@@ -2291,38 +2294,26 @@
pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
if (NULL == pAdapter)
{
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: HDD adapter is Null", __func__);
return -ENODEV;
}
if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic)
{
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: HDD adapter magic is invalid", __func__);
return -ENODEV;
}
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
- if (NULL == pHddCtx)
- {
- VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: HDD context is Null", __func__);
- return -ENODEV;
- }
+ status = wlan_hdd_validate_context(pHddCtx);
- if (pHddCtx->isLogpInProgress)
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
-
- if (pHddCtx->isLoadUnloadInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s: device mode = %d",
@@ -2365,16 +2356,22 @@
struct cfg80211_beacon_data *params)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
- int status=VOS_STATUS_SUCCESS;
+ hdd_context_t *pHddCtx;
+ int status;
ENTER();
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
__func__, pAdapter->device_mode);
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ((pAdapter->device_mode == WLAN_HDD_SOFTAP)
@@ -2452,21 +2449,25 @@
hdd_adapter_t *pP2pAdapter = NULL;
tCsrRoamProfile *pRoamProfile = NULL;
eCsrRoamBssType LastBSSType;
- hdd_config_t *pConfig = pHddCtx->cfg_ini;
+ hdd_config_t *pConfig = NULL;
eMib_dot11DesiredBssType connectedBssType;
VOS_STATUS status;
ENTER();
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "%s:LOGP in Progress. Ignore!!!",__func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
__func__, pAdapter->device_mode);
+ pConfig = pHddCtx->cfg_ini;
wdev = ndev->ieee80211_ptr;
#ifdef WLAN_BTAMP_FEATURE
@@ -3093,20 +3094,24 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
tCsrRoamSetKey setKey;
u8 groupmacaddr[WNI_CFG_BSSID_LEN] = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
- int status = 0;
+ int status;
v_U32_t roamId= 0xFF;
v_CONTEXT_t pVosContext = (WLAN_HDD_GET_CTX(pAdapter))->pvosContext;
hdd_hostapd_state_t *pHostapdState;
VOS_STATUS vos_status;
eHalStatus halStatus;
+ hdd_context_t *pHddCtx;
ENTER();
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
@@ -3601,9 +3606,10 @@
#endif
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
- int status = 0;
+ int status;
hdd_wext_state_t *pWextState;
hdd_station_ctx_t *pHddStaCtx;
+ hdd_context_t *pHddCtx;
ENTER();
@@ -3635,11 +3641,14 @@
return -EINVAL;
}
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ((pAdapter->device_mode == WLAN_HDD_INFRA_STATION)
@@ -4345,12 +4354,12 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
hdd_wext_state_t *pwextBuf = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
- hdd_config_t *cfg_param = (WLAN_HDD_GET_CTX(pAdapter))->cfg_ini;
+ hdd_config_t *cfg_param = NULL;
tCsrScanRequest scanRequest;
tANI_U8 *channelList = NULL, i;
v_U32_t scanId = 0;
- int status = 0;
- hdd_scaninfo_t *pScanInfo = &pHddCtx->scan_info;
+ int status;
+ hdd_scaninfo_t *pScanInfo = NULL;
v_U8_t* pP2pIe = NULL;
ENTER();
@@ -4358,6 +4367,18 @@
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",
__func__,pAdapter->device_mode);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
+ }
+
+ cfg_param = pHddCtx->cfg_ini;
+ pScanInfo = &pHddCtx->scan_info;
+
if ((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
(eConnectionState_Connecting ==
(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState))
@@ -4392,19 +4413,6 @@
return -EBUSY;
}
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
-
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLoadUnloadInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s:Unloading/Loading in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
//Don't Allow Scan and return busy if Remain On
//Channel and action frame is pending
//Otherwise Cancel Remain On Channel and allow Scan
@@ -5547,7 +5555,7 @@
struct cfg80211_connect_params *req
)
{
- int status = 0;
+ int status;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( ndev );
VOS_STATUS exitbmpsStatus = VOS_STATUS_E_INVAL;
hdd_context_t *pHddCtx = NULL;
@@ -5557,11 +5565,14 @@
hddLog(VOS_TRACE_LEVEL_INFO,
"%s: device_mode = %d\n",__func__,pAdapter->device_mode);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
#ifdef WLAN_BTAMP_FEATURE
@@ -5588,16 +5599,7 @@
if((WLAN_HDD_INFRA_STATION == pAdapter->device_mode) &&
(vos_concurrent_sessions_running()))
{
- v_CONTEXT_t pVosContext = vos_get_global_context( VOS_MODULE_ID_HDD, NULL );
-
- if (NULL != pVosContext)
- {
- pHddCtx = vos_get_context( VOS_MODULE_ID_HDD, pVosContext);
- if(NULL != pHddCtx)
- {
- exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
- }
- }
+ exitbmpsStatus = hdd_disable_bmps_imps(pHddCtx, WLAN_HDD_INFRA_STATION);
}
if ( req->channel )
@@ -5609,8 +5611,7 @@
else
{
status = wlan_hdd_cfg80211_connect_start(pAdapter, req->ssid,
- req->ssid_len, req->bssid,
- 0);
+ req->ssid_len, req->bssid, 0);
}
if (0 > status)
@@ -5626,7 +5627,7 @@
hddLog(VOS_TRACE_LEVEL_ERROR, "%s: connect failed", __func__);
return status;
}
- (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_FALSE;
+ pHddCtx->isAmpAllowed = VOS_FALSE;
EXIT();
return status;
}
@@ -5638,11 +5639,23 @@
*/
int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
{
- int status = 0;
+ int status;
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+ hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
+ }
+
+ pHddCtx->isAmpAllowed = VOS_TRUE;
pHddStaCtx->conn_info.connState = eConnectionState_NotConnected;
- (WLAN_HDD_GET_CTX(pAdapter))->isAmpAllowed = VOS_TRUE;
INIT_COMPLETION(pAdapter->disconnect_comp_var);
+
/*issue disconnect*/
status = sme_RoamDisconnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
pAdapter->sessionId, reason);
@@ -5676,7 +5689,7 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
tCsrRoamProfile *pRoamProfile =
&(WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter))->roamProfile;
- int status = 0;
+ int status;
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
#ifdef FEATURE_WLAN_TDLS
@@ -5691,12 +5704,15 @@
hddLog(VOS_TRACE_LEVEL_INFO, "%s: Disconnect called with reason code %d",
__func__, reason);
- if ((WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress)
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!",__func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
+
if (NULL != pRoamProfile)
{
/*issue disconnect request to SME, if station is in connected state*/
@@ -5853,17 +5869,20 @@
tCsrRoamProfile *pRoamProfile;
int status;
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
+ hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
ENTER();
hddLog(VOS_TRACE_LEVEL_INFO,
"%s: device_mode = %d\n",__func__,pAdapter->device_mode);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if (NULL == pWextState)
@@ -5960,14 +5979,18 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
hdd_wext_state_t *pWextState = WLAN_HDD_GET_WEXT_STATE_PTR(pAdapter);
tCsrRoamProfile *pRoamProfile;
+ hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ int status;
ENTER();
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d\n",__func__,pAdapter->device_mode);
@@ -6006,14 +6029,17 @@
{
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
tHalHandle hHal = pHddCtx->hHal;
+ int status;
ENTER();
- if ( pHddCtx->isLogpInProgress )
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if (changed & WIPHY_PARAM_RTS_THRESHOLD)
@@ -6135,12 +6161,24 @@
int dbm)
{
hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
- tHalHandle hHal = pHddCtx->hHal;
+ tHalHandle hHal = NULL;
tSirMacAddr bssid = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
tSirMacAddr selfMac = {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
+ int status;
ENTER();
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
+ }
+
+ hHal = pHddCtx->hHal;
+
if (0 != ccmCfgSetInt(hHal, WNI_CFG_CURRENT_TX_POWER_LEVEL,
dbm, ccmCfgSetCallback,
eANI_BOOLEAN_TRUE))
@@ -6150,13 +6188,6 @@
return -EIO;
}
- if ( pHddCtx->isLogpInProgress )
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
-
hddLog(VOS_TRACE_LEVEL_INFO_MED, "%s: set tx power level %d dbm", __func__,
dbm);
@@ -6195,21 +6226,18 @@
hdd_adapter_t *pAdapter;
hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+ int status;
ENTER();
- if (NULL == pHddCtx)
- {
- hddLog(VOS_TRACE_LEVEL_FATAL,"%s: HDD context is Null",__func__);
- *dbm = 0;
- return -ENOENT;
- }
+ status = wlan_hdd_validate_context(pHddCtx);
- if ( pHddCtx->isLogpInProgress )
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ *dbm = 0;
+ return status;
}
pAdapter = hdd_get_adapter(pHddCtx, WLAN_HDD_INFRA_STATION);
@@ -6251,6 +6279,7 @@
tANI_U8 rateFlag = 1;
tANI_U8 i, j, rssidx;
tANI_U16 temp;
+ int status;
#ifdef WLAN_FEATURE_11AC
tANI_U32 vht_mcs_map;
@@ -6268,11 +6297,13 @@
return 0;
}
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
wlan_hdd_get_rssi(pAdapter, &sinfo->signal);
@@ -6634,6 +6665,7 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx;
VOS_STATUS vos_status;
+ int status;
ENTER();
@@ -6644,17 +6676,13 @@
}
pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
- if (NULL == pHddCtx)
- {
- hddLog(VOS_TRACE_LEVEL_FATAL, "%s: HDD context is NULL\n", __func__);
- return -ENODEV;
- }
+ status = wlan_hdd_validate_context(pHddCtx);
- if ( pHddCtx->isLogpInProgress )
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ((DRIVER_POWER_MODE_AUTO == !mode) &&
@@ -6718,28 +6746,26 @@
struct net_device *dev, u8 *mac)
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+ hdd_context_t *pHddCtx;
VOS_STATUS vos_status;
+ int status;
v_U8_t staId;
ENTER();
- if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
+ if ( NULL == pAdapter )
{
- hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__);
return -EINVAL;
}
- if (((hdd_context_t*)pAdapter->pHddCtx)->isLoadUnloadInProgress)
- {
- hddLog( LOGE,
- "%s: Wlan Load/Unload is in progress", __func__);
- return -EBUSY;
- }
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
if ( (WLAN_HDD_SOFTAP == pAdapter->device_mode)
@@ -6858,29 +6884,27 @@
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
tHalHandle halHandle;
eHalStatus result;
+ int status;
tANI_U8 BSSIDMatched = 0;
+ hdd_context_t *pHddCtx;
ENTER();
// Validate pAdapter
- if ( NULL == pAdapter || NULL == pAdapter->pHddCtx)
+ if ( NULL == pAdapter )
{
- hddLog(VOS_TRACE_LEVEL_FATAL, "%s: Invalid Adapter or HDD Context " ,__func__);
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: Invalid Adapter" ,__func__);
return -EINVAL;
}
- if (((hdd_context_t*)pAdapter->pHddCtx)->isLoadUnloadInProgress)
- {
- hddLog( LOGE,
- "%s: Wlan Load/Unload is in progress", __func__);
- return -EBUSY;
- }
+ pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
+ status = wlan_hdd_validate_context(pHddCtx);
- if ( (WLAN_HDD_GET_CTX(pAdapter))->isLogpInProgress )
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
// Retrieve halHandle
@@ -7466,9 +7490,9 @@
{
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
+ int status;
#ifdef FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
- int status = 0;
tANI_U8 staIdx;
#endif
#ifdef WLAN_FEATURE_TDLS_DEBUG
@@ -7482,18 +7506,20 @@
#endif
hddTdlsPeer_t *pTdlsPeer;
- if ( NULL == pHddCtx || NULL == pHddCtx->cfg_ini || NULL == peer )
+ if ( NULL == peer )
{
VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
"%s: Invalid arguments", __func__);
return -EINVAL;
}
- if (pHddCtx->isLogpInProgress)
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EBUSY;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
pTdlsPeer = wlan_hdd_tdls_find_peer(pAdapter, peer);
@@ -7683,6 +7709,7 @@
hdd_context_t *pHddCtx = wiphy_priv(wiphy);
hdd_station_ctx_t *pHddStaCtx;
tHalHandle hHal;
+ int result;
tpSirGtkOffloadParams pGtkOffloadReqParams;
eHalStatus status = eHAL_STATUS_FAILURE;
@@ -7695,25 +7722,13 @@
return -ENODEV;
}
- if (NULL == pHddCtx)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s: HDD context is Null!!!", __func__);
- return -ENODEV;
- }
+ result = wlan_hdd_validate_context(pHddCtx);
- if (pHddCtx->isLogpInProgress)
+ if (0 != result)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
-
- if (pHddCtx->isLoadUnloadInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL,
- "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return result;
}
pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index ee259ff..a171d37 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -413,6 +413,37 @@
}
}
+/*
+ * FUNCTION: wlan_hdd_validate_context
+ * This function is used to check the HDD context
+ */
+int wlan_hdd_validate_context(hdd_context_t *pHddCtx)
+{
+ ENTER();
+
+ if (NULL == pHddCtx || NULL == pHddCtx->cfg_ini)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is Null", __func__);
+ return -ENODEV;
+ }
+
+ if (pHddCtx->isLogpInProgress)
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: LOGP in Progress. Ignore!!!", __func__);
+ return -EAGAIN;
+ }
+
+ if (pHddCtx->isLoadUnloadInProgress)
+ {
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: Unloading/Loading in Progress. Ignore!!!", __func__);
+ return -EAGAIN;
+ }
+ return 0;
+}
+
void hdd_checkandupdate_phymode( hdd_adapter_t *pAdapter, char *country_code)
{
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index e499ac1..44953b1 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -57,6 +57,7 @@
#include "sme_Api.h"
#include "wlan_hdd_p2p.h"
#include "sapApi.h"
+#include "wlan_hdd_main.h"
#include <linux/netdevice.h>
#include <linux/skbuff.h>
@@ -452,15 +453,18 @@
#endif
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
- int status = 0;
+ hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
+ int status;
hddLog( LOG1, "Cancel remain on channel req");
- if (((hdd_context_t*)pAdapter->pHddCtx)->isLogpInProgress)
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
/* FIXME cancel currently running remain on chan.
* Need to check cookie and cancel accordingly
@@ -473,8 +477,8 @@
__func__);
return -EINVAL;
}
-
- /* wait until remain on channel ready event received
+
+ /* wait until remain on channel ready event received
* for already issued remain on channel request */
status = wait_for_completion_interruptible_timeout(&pAdapter->rem_on_chan_ready_event,
msecs_to_jiffies(WAIT_REM_CHAN_READY));
@@ -549,11 +553,13 @@
#endif
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR( dev );
hdd_cfg80211_state_t *cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter );
+ hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX( pAdapter );
tANI_U16 extendedWait = 0;
tANI_U8 type = WLAN_HDD_GET_TYPE_FRM_FC(buf[0]);
tANI_U8 subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(buf[0]);
tActionFrmType actionFrmType;
bool noack = 0;
+ int status;
#ifdef WLAN_FEATURE_11W
tANI_U8 *pTxFrmBuf = (tANI_U8 *) buf; // For SA Query, we have to set protect bit
#endif
@@ -562,12 +568,15 @@
hdd_adapter_t *goAdapter;
#endif
- if (((hdd_context_t*)pAdapter->pHddCtx)->isLogpInProgress)
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
{
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EBUSY;
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
}
+
#ifdef WLAN_FEATURE_P2P_DEBUG
if ((type == SIR_MAC_MGMT_FRAME) &&
(subType == SIR_MAC_MGMT_ACTION) &&
@@ -1246,26 +1255,30 @@
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,6,0))
struct net_device *dev = wdev->netdev;
#endif
- hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
- hdd_adapter_t *pVirtAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
- ENTER();
+ hdd_context_t *pHddCtx = (hdd_context_t*) wiphy_priv(wiphy);
+ hdd_adapter_t *pVirtAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
+ int status;
+ ENTER();
- hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
- __func__,pVirtAdapter->device_mode);
- if (pHddCtx->isLogpInProgress)
- {
- VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
- "%s:LOGP in Progress. Ignore!!!", __func__);
- return -EAGAIN;
- }
+ hddLog(VOS_TRACE_LEVEL_INFO, "%s: device_mode = %d",
+ __func__,pVirtAdapter->device_mode);
- wlan_hdd_release_intf_addr( pHddCtx,
+ status = wlan_hdd_validate_context(pHddCtx);
+
+ if (0 != status)
+ {
+ VOS_TRACE( VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: HDD context is not valid", __func__);
+ return status;
+ }
+
+ wlan_hdd_release_intf_addr( pHddCtx,
pVirtAdapter->macAddressCurrent.bytes );
- hdd_stop_adapter( pHddCtx, pVirtAdapter );
- hdd_close_adapter( pHddCtx, pVirtAdapter, TRUE );
- EXIT();
- return 0;
+ hdd_stop_adapter( pHddCtx, pVirtAdapter );
+ hdd_close_adapter( pHddCtx, pVirtAdapter, TRUE );
+ EXIT();
+ return 0;
}
void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter,