summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaidiReddy Yenuga <saidir@codeaurora.org>2017-02-15 15:35:29 +0530
committerSaidiReddy Yenuga <saidir@codeaurora.org>2017-03-01 17:07:44 +0530
commit468ef145bd32141319ca8868b67c6ebd04806d6d (patch)
tree16af0b85011d3cd0b2915adcc2389f81576fe228
parent3bac46da99ce53979c112407d9aa44a70be5277c (diff)
qcacld-3.0: Add NULL Check in iwpriv ioctl iw_setint_getnone
qcacld-2.0 to qcacld-3.0 propagation iw_setint_getnone can cause crash in monitor mode as hal context is not initialized. Modify the code to handle dereferencing hHal in Driver Monitor mode. CRs-Fixed: 1040579 Change-Id: If26cfab5374ac34c55e03b887c320c0736a9df23
-rw-r--r--core/hdd/src/wlan_hdd_wext.c64
1 files changed, 60 insertions, 4 deletions
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index b81b30c77b1c..1ff61a64dd17 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -4029,6 +4029,9 @@ int hdd_set_ldpc(hdd_adapter_t *adapter, int value)
tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
int ret;
+ if (!hal)
+ return -EINVAL;
+
hdd_alert("%d", value);
if (value) {
/* make sure HT capabilities allow this */
@@ -4097,6 +4100,9 @@ int hdd_set_tx_stbc(hdd_adapter_t *adapter, int value)
tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
int ret;
+ if (!hal)
+ return -EINVAL;
+
hdd_alert("%d", value);
if (value) {
/* make sure HT capabilities allow this */
@@ -4164,6 +4170,9 @@ int hdd_set_rx_stbc(hdd_adapter_t *adapter, int value)
tHalHandle hal = WLAN_HDD_GET_HAL_CTX(adapter);
int ret;
+ if (!hal)
+ return -EINVAL;
+
hdd_alert("set rx_stbc : %d", value);
if (value) {
/* make sure HT capabilities allow this */
@@ -7490,8 +7499,8 @@ static int __iw_setint_getnone(struct net_device *dev,
switch (sub_cmd) {
case WE_SET_11D_STATE:
{
- if ((ENABLE_11D == set_value)
- || (DISABLE_11D == set_value)) {
+ if (((ENABLE_11D == set_value)
+ || (DISABLE_11D == set_value)) && hHal) {
sme_get_config_param(hHal, &smeConfig);
smeConfig.csrConfig.Is11dSupportEnabled =
@@ -7510,6 +7519,9 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_WOWL:
{
+ if (!hHal)
+ return -EINVAL;
+
switch (set_value) {
case 0x00:
hdd_exit_wowl(pAdapter);
@@ -7535,6 +7547,9 @@ static int __iw_setint_getnone(struct net_device *dev,
}
case WE_SET_POWER:
{
+ if (!hHal)
+ return -EINVAL;
+
switch (set_value) {
case 1:
/* Enable PowerSave */
@@ -7563,6 +7578,9 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_SET_MAX_ASSOC:
{
+ if (!hHal)
+ return -EINVAL;
+
if ((WNI_CFG_ASSOC_STA_LIMIT_STAMIN > set_value) ||
(WNI_CFG_ASSOC_STA_LIMIT_STAMAX < set_value)) {
ret = -EINVAL;
@@ -7584,6 +7602,9 @@ static int __iw_setint_getnone(struct net_device *dev,
break;
case WE_SET_DATA_INACTIVITY_TO:
+ if (!hHal)
+ return -EINVAL;
+
if ((set_value < CFG_DATA_INACTIVITY_TIMEOUT_MIN) ||
(set_value > CFG_DATA_INACTIVITY_TIMEOUT_MAX) ||
(sme_cfg_set_int((WLAN_HDD_GET_CTX(pAdapter))->hHal,
@@ -7595,6 +7616,9 @@ static int __iw_setint_getnone(struct net_device *dev,
break;
case WE_SET_MC_RATE:
{
+ if (!hHal)
+ return -EINVAL;
+
ret = wlan_hdd_set_mc_rate(pAdapter, set_value);
break;
}
@@ -7602,6 +7626,9 @@ static int __iw_setint_getnone(struct net_device *dev,
{
struct qdf_mac_addr bssid;
+ if (!hHal)
+ return -EINVAL;
+
qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId);
if (sme_set_tx_power
(hHal, pAdapter->sessionId, bssid,
@@ -7617,6 +7644,9 @@ static int __iw_setint_getnone(struct net_device *dev,
struct qdf_mac_addr bssid;
struct qdf_mac_addr selfMac;
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("Setting maximum tx power %d dBm",
set_value);
qdf_copy_macaddr(&bssid, &pHddStaCtx->conn_info.bssId);
@@ -7674,6 +7704,9 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_SET_TM_LEVEL:
{
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("Set Thermal Mitigation Level %d", set_value);
(void)sme_set_thermal_level(hHal, set_value);
break;
@@ -7682,6 +7715,8 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_SET_PHYMODE:
{
hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter);
+ if (!hHal)
+ return -EINVAL;
ret =
wlan_hdd_update_phymode(dev, hHal, set_value,
@@ -7691,6 +7726,9 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_SET_NSS:
{
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("Set NSS = %d", set_value);
if ((set_value > 2) || (set_value <= 0)) {
hdd_err("NSS greater than 2 not supported");
@@ -7798,6 +7836,9 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_SET_SHORT_GI:
{
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("WMI_VDEV_PARAM_SGI val %d", set_value);
ret = sme_update_ht_config(hHal, pAdapter->sessionId,
WNI_CFG_HT_CAP_INFO_SHORT_GI_20MHZ,
@@ -7811,6 +7852,9 @@ static int __iw_setint_getnone(struct net_device *dev,
{
uint32_t value;
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("WMI_VDEV_PARAM_ENABLE_RTSCTS val 0x%x",
set_value);
@@ -7845,6 +7889,9 @@ static int __iw_setint_getnone(struct net_device *dev,
{
bool chwidth = false;
hdd_context_t *phddctx = WLAN_HDD_GET_CTX(pAdapter);
+ if (!hHal)
+ return -EINVAL;
+
/*updating channel bonding only on 5Ghz */
hdd_notice("WMI_VDEV_PARAM_CHWIDTH val %d",
set_value);
@@ -8441,8 +8488,11 @@ static int __iw_setint_getnone(struct net_device *dev,
{
hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
+ if (!hHal)
+ return -EINVAL;
+
hdd_ctx->config->gEnableDebugLog = set_value;
- sme_update_connect_debug(hdd_ctx->hHal, set_value);
+ sme_update_connect_debug(hHal, set_value);
break;
}
case WE_SET_EARLY_RX_ADJUST_ENABLE:
@@ -8515,8 +8565,11 @@ static int __iw_setint_getnone(struct net_device *dev,
}
case WE_SET_SCAN_DISABLE:
{
+ if (!hHal)
+ return -EINVAL;
+
hdd_notice("SET SCAN DISABLE %d", set_value);
- sme_set_scan_disable(WLAN_HDD_GET_HAL_CTX(pAdapter), set_value);
+ sme_set_scan_disable(hHal, set_value);
break;
}
case WE_START_FW_PROFILE:
@@ -8531,6 +8584,9 @@ static int __iw_setint_getnone(struct net_device *dev,
{
hdd_notice("Set Channel %d Session ID %d mode %d", set_value,
pAdapter->sessionId, pAdapter->device_mode);
+ if (!hHal)
+ return -EINVAL;
+
if ((QDF_STA_MODE == pAdapter->device_mode) ||
(QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) {