From d5be743510d856d89c665ac6028ce8ee719960fc Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Thu, 19 Dec 2019 19:00:40 +0530 Subject: [PATCH] qcacld-3.0: Reject monitor mode command if invalid BW Reject moniotr mode request if the BW given in the start monitor command does not match with the FW capability. Change-Id: Ic1e2f4bcb811ec56526ae179407db197af591c9c CRs-Fixed: 2590873 --- core/hdd/src/wlan_hdd_main.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 729508f749bf..6cab389d9738 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6782,6 +6782,8 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, struct qdf_mac_addr bssid; struct csr_roam_profile roam_profile; struct ch_params ch_params; + enum phy_ch_width max_fw_bw; + enum phy_ch_width ch_width; if (hdd_get_conparam() != QDF_GLOBAL_MONITOR_MODE) { hdd_err("Not supported, device is not in monitor mode"); @@ -6794,6 +6796,21 @@ int wlan_hdd_set_mon_chan(struct hdd_adapter *adapter, uint32_t chan, return -EINVAL; } + /* Verify the BW before accepting this request */ + ch_width = bandwidth; + + max_fw_bw = sme_get_vht_ch_width(); + + hdd_debug("max fw BW %d ch width %d", max_fw_bw, ch_width); + if ((ch_width == CH_WIDTH_160MHZ && + max_fw_bw <= WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ) || + (ch_width == CH_WIDTH_80P80MHZ && + max_fw_bw <= WNI_CFG_VHT_CHANNEL_WIDTH_160MHZ)) { + hdd_err("FW does not support this BW %d max BW supported %d", + ch_width, max_fw_bw); + return -EINVAL; + } + if (WLAN_REG_IS_24GHZ_CH(chan)) { if (bandwidth == CH_WIDTH_80MHZ) { hdd_err("BW80 not possible in 2.4GHz band");