diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 56b4c5f1fdda..1eba2c5b683a 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -3057,6 +3057,14 @@ static int __wlan_hdd_cfg80211_do_acs(struct wiphy *wiphy, hdd_debug("waiting for channel list to update"); qdf_wait_for_event_completion(&hdd_ctx->regulatory_update_event, CHANNEL_LIST_UPDATE_TIMEOUT); + /* In case of set country failure in FW, response never comes + * so wait the full timeout, then set in_progress to false. + * If the response comes back, in_progress will already be set + * to false anyways. + */ + qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); + hdd_ctx->is_regulatory_update_in_progress = false; + qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } else { qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } @@ -20735,6 +20743,14 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, hdd_debug("waiting for channel list to update"); qdf_wait_for_event_completion(&hdd_ctx->regulatory_update_event, CHANNEL_LIST_UPDATE_TIMEOUT); + /* In case of set country failure in FW, response never comes + * so wait the full timeout, then set in_progress to false. + * If the response comes back, in_progress will already be set + * to false anyways. + */ + qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); + hdd_ctx->is_regulatory_update_in_progress = false; + qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } else { qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index e2c0381af63d..ce71305fb029 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -6486,6 +6486,14 @@ static int __wlan_hdd_cfg80211_start_ap(struct wiphy *wiphy, hdd_debug("waiting for channel list to update"); qdf_wait_for_event_completion(&hdd_ctx->regulatory_update_event, CHANNEL_LIST_UPDATE_TIMEOUT); + /* In case of set country failure in FW, response never comes + * so wait the full timeout, then set in_progress to false. + * If the response comes back, in_progress will already be set + * to false anyways. + */ + qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); + hdd_ctx->is_regulatory_update_in_progress = false; + qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } else { qdf_mutex_release(&hdd_ctx->regulatory_status_lock); } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index bf16251d309c..0e3e977f2b3f 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -757,8 +757,12 @@ int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code) qdf_mutex_release(&hdd_ctx->regulatory_status_lock); status = ucfg_reg_set_country(hdd_ctx->pdev, cc); - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Failed to set country"); + qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); + hdd_ctx->is_regulatory_update_in_progress = false; + qdf_mutex_release(&hdd_ctx->regulatory_status_lock); + } return qdf_status_to_os_return(status); } @@ -931,8 +935,12 @@ void hdd_reg_notifier(struct wiphy *wiphy, break; } - if (QDF_IS_STATUS_ERROR(status)) + if (QDF_IS_STATUS_ERROR(status)) { hdd_err("Failed to set country"); + qdf_mutex_acquire(&hdd_ctx->regulatory_status_lock); + hdd_ctx->is_regulatory_update_in_progress = false; + qdf_mutex_release(&hdd_ctx->regulatory_status_lock); + } } #else void hdd_reg_notifier(struct wiphy *wiphy,