qcacld-3.0: Add check to validate the Tx chainmask value

Add a sanity check to validate the Tx chainmask value
sent from the user space for each HW mode.

Change-Id: I2705efe20fcb13bf8343088ceecb4207e2562789
CRs-Fixed: 2943363
This commit is contained in:
Aditya Kodukula 2021-05-11 14:28:34 -07:00 • committed by Madan Koyyalamudi
commit aadbf5a316

View file

@ -846,6 +846,28 @@ static void wma_set_dtim_period(tp_wma_handle wma,
}
static inline bool wma_is_tx_chainmask_valid(int value,
struct target_psoc_info *tgt_hdl)
{
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap;
uint8_t total_mac_phy_cnt, i;
mac_phy_cap = target_psoc_get_mac_phy_cap(tgt_hdl);
if (!mac_phy_cap) {
wma_err("Invalid MAC PHY capabilities handle");
return false;
}
total_mac_phy_cnt = target_psoc_get_total_mac_phy_cnt(tgt_hdl);
for (i = 0; i < total_mac_phy_cnt; i++) {
if (((mac_phy_cap[i].tx_chain_mask_5G) & (value))) {
return true;
}
}
return false;
}
/**
* wma_process_cli_set_cmd() - set parameters to fw
* @wma: wma handle
@ -917,6 +939,14 @@ static void wma_process_cli_set_cmd(tp_wma_handle wma,
return;
}
}
if (privcmd->param_id == WMI_PDEV_PARAM_TX_CHAIN_MASK) {
if (!wma_is_tx_chainmask_valid(privcmd->param_value,
tgt_hdl)) {
wma_debug("Chainmask value is invalid");
return;
}
}
pdev_param.param_id = privcmd->param_id;
pdev_param.param_value = privcmd->param_value;
ret = wmi_unified_pdev_param_send(wma->wmi_handle,