summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChandrasekaran, Manishekar <cmshekar@qti.qualcomm.com>2014-01-18 00:38:23 -0800
committerPrakash Dhavali <pdhavali@codeaurora.org>2014-01-18 02:43:14 -0800
commit62fc68e251d5160aa88580c82aa03e4914aeaeea (patch)
tree518b720c9e4964a290f473e4919b5222770993a8
parentab56f35d46d37fddb78f3bf81df75191fd79b188 (diff)
cld: restrict the userspace from adding more vdevs than allowed by the Host
The Host by default configures the number of vdevs in the target.For Rome, this default value is 3 (5 for HL). In the issue scenario, the Host tries to configure more than 3 vdevs. This results in assert. Changes are done to restrict the userspace from adding more than the configured number of vdevs Change-Id: I91d7e54d0d86b59703de57c34fc6ff5c2d2d509c CRs-Fixed: 598220
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h4
-rw-r--r--CORE/HDD/inc/wlan_hdd_tgt_cfg.h1
-rw-r--r--CORE/HDD/src/wlan_hdd_main.c23
-rw-r--r--CORE/HDD/src/wlan_hdd_p2p.c2
-rw-r--r--CORE/SERVICES/WMA/wma.c2
5 files changed, 31 insertions, 1 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index 4092d3c680c6..791ade2d26f7 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -1236,6 +1236,10 @@ struct hdd_context_s
v_U16_t unsafe_channel_count;
v_U16_t unsafe_channel_list[NUM_20MHZ_RF_CHANNELS];
#endif /* FEATURE_WLAN_CH_AVOID */
+
+ v_U8_t max_intf_count;
+ v_U8_t current_intf_count;
+
};
diff --git a/CORE/HDD/inc/wlan_hdd_tgt_cfg.h b/CORE/HDD/inc/wlan_hdd_tgt_cfg.h
index 96497923367e..120905a36547 100644
--- a/CORE/HDD/inc/wlan_hdd_tgt_cfg.h
+++ b/CORE/HDD/inc/wlan_hdd_tgt_cfg.h
@@ -91,6 +91,7 @@ struct hdd_tgt_cfg {
#ifdef WLAN_FEATURE_11AC
struct hdd_tgt_vht_cap vht_cap;
#endif
+ v_U8_t max_intf_count;
};
struct hdd_dfs_radar_ind {
diff --git a/CORE/HDD/src/wlan_hdd_main.c b/CORE/HDD/src/wlan_hdd_main.c
index 076e51ad3728..31cd11df4f70 100644
--- a/CORE/HDD/src/wlan_hdd_main.c
+++ b/CORE/HDD/src/wlan_hdd_main.c
@@ -4687,6 +4687,8 @@ void hdd_update_tgt_cfg(void *context, void *param)
hdd_ctx->target_fw_version = cfg->target_fw_version;
+ hdd_ctx->max_intf_count = cfg->max_intf_count;
+
hdd_update_tgt_services(hdd_ctx, &cfg->services);
hdd_update_tgt_ht_cap(hdd_ctx, &cfg->ht_cap);
@@ -6518,6 +6520,16 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
hddLog(VOS_TRACE_LEVEL_INFO_HIGH, "%s iface =%s type = %d\n",__func__,iface_name,session_type);
+ if (pHddCtx->current_intf_count >= pHddCtx->max_intf_count){
+ /* Max limit reached on the number of vdevs configured by the host.
+ * Return error
+ */
+ VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
+ "%s: Unable to add virtual intf: currentVdevCnt=%d,hostConfiguredVdevCnt=%d",
+ __func__,pHddCtx->current_intf_count, pHddCtx->max_intf_count);
+ return NULL;
+ }
+
/*
* If Powersave Offload is enabled
* Fw will take care incase of concurrency
@@ -6718,6 +6730,10 @@ hdd_adapter_t* hdd_open_adapter( hdd_context_t *pHddCtx, tANI_U8 session_type,
hddLog(VOS_TRACE_LEVEL_FATAL,"%s: hdd_init_wowl failed",__func__);
goto err_free_netdev;
}
+
+ /* Adapter successfully added. Increment the vdev count */
+ pHddCtx->current_intf_count++;
+
}
return pAdapter;
@@ -6783,6 +6799,10 @@ VOS_STATUS hdd_close_adapter( hdd_context_t *pHddCtx, hdd_adapter_t *pAdapter,
hdd_remove_adapter( pHddCtx, pAdapterNode );
vos_mem_free( pAdapterNode );
+ /* Adapter removed. Decrement vdev count */
+ if (pHddCtx->current_intf_count != 0)
+ pHddCtx->current_intf_count--;
+
#ifdef FEATURE_WLAN_TDLS
mutex_unlock(&pHddCtx->tdls_lock);
#endif
@@ -8570,6 +8590,9 @@ int hdd_wlan_startup(struct device *dev, v_VOID_t *hif_sc)
goto err_config;
}
+ pHddCtx->current_intf_count=0;
+ pHddCtx->max_intf_count = WLAN_MAX_INTERFACES;
+
#ifndef QCA_WIFI_2_0
pHddCtx->cfg_ini->maxWoWFilters = WOWL_MAX_PTRNS_ALLOWED;
#endif
diff --git a/CORE/HDD/src/wlan_hdd_p2p.c b/CORE/HDD/src/wlan_hdd_p2p.c
index b1d115c5bc79..71ae70988494 100644
--- a/CORE/HDD/src/wlan_hdd_p2p.c
+++ b/CORE/HDD/src/wlan_hdd_p2p.c
@@ -1329,7 +1329,7 @@ int wlan_hdd_add_virtual_intf( struct wiphy *wiphy, char *name,
{
hddLog(VOS_TRACE_LEVEL_ERROR,"%s: hdd_open_adapter failed",__func__);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38))
- return NULL;
+ return ERR_PTR(-ENOSPC);
#else
return -EINVAL;
#endif
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index 8ccdbc4dea5e..207cd2910088 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -13979,6 +13979,8 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
hdd_tgt_cfg.band_cap = eCSR_BAND_ALL;
}
+ hdd_tgt_cfg.max_intf_count = wma_handle->wlan_resource_config.num_vdevs;
+
adf_os_mem_copy(hdd_tgt_cfg.hw_macaddr.bytes, wma_handle->hwaddr,
ATH_MAC_LEN);