diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index d1b544547b..47ac407669 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -4187,7 +4187,8 @@ static void hdd_skip_acs_scan_timer_deinit(struct hdd_context *hdd_ctx) {} */ int hdd_update_country_code(struct hdd_context *hdd_ctx) { - if (!country_code) + if (!country_code || + !ucfg_reg_is_user_country_set_allowed(hdd_ctx->psoc)) return 0; return hdd_reg_set_country(hdd_ctx, country_code); diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index a14076f4e2..dfb8bf450e 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -867,6 +867,11 @@ int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code) return -EINVAL; } + if (!ucfg_reg_is_user_country_set_allowed(hdd_ctx->psoc)) { + hdd_err("user_country is not allowed"); + return -EINVAL; + } + qdf_mem_copy(cc, country_code, REG_ALPHA2_LEN); cc[REG_ALPHA2_LEN] = '\0';