diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index 70e09bf55738..89bb5de70db3 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -404,9 +404,14 @@ static __iw_softap_setparam(struct net_device *dev, CSA_REASON_USER_INITIATED); hdd_debug("SET Channel Change to new channel= %d", set_value); - ret = hdd_softap_set_channel_change(dev, - wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, set_value), - CH_WIDTH_MAX, false); + if (set_value <= wlan_reg_max_5ghz_ch_num()) + set_value = wlan_reg_legacy_chan_to_freq( + hdd_ctx->pdev, + set_value); + + ret = hdd_softap_set_channel_change(dev, set_value, + CH_WIDTH_MAX, + false); } else { hdd_err("Channel Change Failed, Device in test mode"); ret = -EINVAL; diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index c799d77dd5a6..82098e67c45b 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6493,9 +6493,12 @@ static int drv_cmd_set_channel_switch(struct hdd_adapter *adapter, wlan_hdd_set_sap_csa_reason(hdd_ctx->psoc, adapter->vdev_id, CSA_REASON_USER_INITIATED); - status = hdd_softap_set_channel_change(dev, - wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, chan_number), - width, true); + + if (chan_number <= wlan_reg_max_5ghz_ch_num()) + chan_number = wlan_reg_legacy_chan_to_freq(hdd_ctx->pdev, + chan_number); + + status = hdd_softap_set_channel_change(dev, chan_number, width, true); if (status) { hdd_err("Set channel change fail"); return status;