summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiran Kumar Lokere <klokere@codeaurora.org>2017-11-17 18:59:44 -0800
committersnandini <snandini@codeaurora.org>2017-11-21 02:04:53 -0800
commite6690f4d23a26bb119d5ed14d09726ffb730e600 (patch)
tree019cf4a1570f40044616dfa2c22a70ba035de3b6
parent075e3c418074214b493e40a7fbe7cae7cd495b5a (diff)
qcacld-3.0: Do not process invalid reg update request
Do not process the reg notifier request if the regulatory information is invalid Change-Id: I13e288cd03e3fbdb192733a6675c7ec00e927250 CRs-Fixed: 2145505
-rw-r--r--core/cds/src/cds_regdomain.c5
-rw-r--r--core/hdd/inc/wlan_hdd_regulatory.h4
-rw-r--r--core/hdd/src/wlan_hdd_main.c6
-rw-r--r--core/hdd/src/wlan_hdd_regulatory.c21
4 files changed, 27 insertions, 9 deletions
diff --git a/core/cds/src/cds_regdomain.c b/core/cds/src/cds_regdomain.c
index 6cef51edc95d..74f56e90ab76 100644
--- a/core/cds/src/cds_regdomain.c
+++ b/core/cds/src/cds_regdomain.c
@@ -713,6 +713,11 @@ void cds_fill_and_send_ctl_to_fw(struct regulatory *reg)
return;
}
+ if (!reg->regpair) {
+ QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR,
+ FL("no regpair is found, can not proceed"));
+ return;
+ }
regpair = reg->regpair;
reg_dmn_2g = get_reg_dmn(regpair->reg_dmn_2ghz);
if (!reg_dmn_2g) {
diff --git a/core/hdd/inc/wlan_hdd_regulatory.h b/core/hdd/inc/wlan_hdd_regulatory.h
index 30ece607e7a1..d914889ad095 100644
--- a/core/hdd/inc/wlan_hdd_regulatory.h
+++ b/core/hdd/inc/wlan_hdd_regulatory.h
@@ -76,8 +76,8 @@ void hdd_modify_indoor_channel_state_flags(
* hdd_apply_cached_country_info() - apply cached ctry info
* @hdd_ctx: hdd context
*
- * Return: void
+ * Return: Error code
*/
-void hdd_apply_cached_country_info(hdd_context_t *hdd_ctx);
+int hdd_apply_cached_country_info(hdd_context_t *hdd_ctx);
#endif
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c
index b57c89d152d8..459bd4214472 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -9179,8 +9179,12 @@ static int hdd_pre_enable_configure(hdd_context_t *hdd_ctx)
goto out;
}
- hdd_apply_cached_country_info(hdd_ctx);
+ ret = hdd_apply_cached_country_info(hdd_ctx);
+ if (0 != ret) {
+ hdd_err("reg info update failed");
+ goto out;
+ }
cds_fill_and_send_ctl_to_fw(&hdd_ctx->reg);
status = hdd_set_sme_chan_list(hdd_ctx);
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index f035474ffa04..ed09b654f726 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -184,9 +184,9 @@ static bool hdd_is_world_regdomain(uint32_t reg_domain)
* hdd_update_regulatory_info() - update regulatory info
* @hdd_ctx: hdd context
*
- * Return: void
+ * Return: Error Code
*/
-static void hdd_update_regulatory_info(hdd_context_t *hdd_ctx)
+static int hdd_update_regulatory_info(hdd_context_t *hdd_ctx)
{
uint32_t country_code;
@@ -195,7 +195,7 @@ static void hdd_update_regulatory_info(hdd_context_t *hdd_ctx)
hdd_ctx->reg.reg_domain = CTRY_FLAG;
hdd_ctx->reg.reg_domain |= country_code;
- cds_fill_some_regulatory_info(&hdd_ctx->reg);
+ return cds_fill_some_regulatory_info(&hdd_ctx->reg);
}
@@ -700,15 +700,19 @@ static void hdd_restore_reg_flags(struct wiphy *wiphy, uint32_t flags)
}
#endif
-void hdd_apply_cached_country_info(hdd_context_t *hdd_ctx)
+int hdd_apply_cached_country_info(hdd_context_t *hdd_ctx)
{
+ int ret_val = 0;
- hdd_update_regulatory_info(hdd_ctx);
+ ret_val = hdd_update_regulatory_info(hdd_ctx);
+ if (ret_val)
+ return ret_val;
hdd_process_regulatory_data(hdd_ctx, hdd_ctx->wiphy,
hdd_ctx->reg.reset);
sme_set_cc_src(hdd_ctx->hHal, hdd_ctx->reg.cc_src);
+ return ret_val;
}
/**
@@ -724,6 +728,7 @@ void hdd_reg_notifier(struct wiphy *wiphy,
hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
bool reset = false;
enum dfs_region dfs_reg;
+ int32_t ret_val;
hdd_debug("country: %c%c, initiator %d, dfs_region: %d",
request->alpha2[0],
@@ -822,8 +827,12 @@ void hdd_reg_notifier(struct wiphy *wiphy,
return;
}
- hdd_apply_cached_country_info(hdd_ctx);
+ ret_val = hdd_apply_cached_country_info(hdd_ctx);
+ if (ret_val) {
+ hdd_err("invalid reg info, do not process");
+ return;
+ }
sme_generic_change_country_code(hdd_ctx->hHal,
hdd_ctx->reg.alpha2);