From a6e01c070bdfad89a953f540ed5366e1f7468eac Mon Sep 17 00:00:00 2001 From: Kiran Kumar Lokere Date: Fri, 17 Nov 2017 18:59:44 -0800 Subject: [PATCH] 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 --- core/cds/src/cds_regdomain.c | 5 +++++ core/hdd/src/wlan_hdd_main.c | 1 - core/hdd/src/wlan_hdd_regulatory.c | 13 +++++++++---- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/cds/src/cds_regdomain.c b/core/cds/src/cds_regdomain.c index 998eb1a848c8..177fdb7e5c28 100644 --- a/core/cds/src/cds_regdomain.c +++ b/core/cds/src/cds_regdomain.c @@ -685,6 +685,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/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 4a541953d5a8..b9f2bd4c1289 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -9074,7 +9074,6 @@ static int hdd_pre_enable_configure(struct hdd_context *hdd_ctx) goto out; } - status = hdd_set_sme_chan_list(hdd_ctx); if (status != QDF_STATUS_SUCCESS) { hdd_err("Failed to init channel list: %d", status); diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index ed5f9d124c87..1d01d398354c 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -180,9 +180,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(struct hdd_context *hdd_ctx) +static int hdd_update_regulatory_info(struct hdd_context *hdd_ctx) { uint32_t country_code; @@ -191,7 +191,7 @@ static void hdd_update_regulatory_info(struct hdd_context *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); } @@ -689,6 +689,7 @@ void hdd_reg_notifier(struct wiphy *wiphy, bool reset = false; enum dfs_reg dfs_reg; struct reg_config_vars config_vars; + int ret_val; hdd_debug("country: %c%c, initiator %d, dfs_region: %d", request->alpha2[0], @@ -769,7 +770,11 @@ void hdd_reg_notifier(struct wiphy *wiphy, hdd_ctx->reg.alpha2[0] = request->alpha2[0]; hdd_ctx->reg.alpha2[1] = request->alpha2[1]; - hdd_update_regulatory_info(hdd_ctx); + ret_val = hdd_update_regulatory_info(hdd_ctx); + if (ret_val) { + hdd_err("invalid reg info, do not process"); + return; + } hdd_process_regulatory_data(hdd_ctx, wiphy, reset);