qcacld-3.0: Check input parameters for tx_attr/rx_attr

In hdd_config_tx_rx_nss and hdd_config_vdev_chains, it
missed to check if tx_attr or rx_attr is null, which will
cause invalid memory access.

Change-Id: Ic3427d714e240507cf4253588f706d06d355ba93
CRs-Fixed: 3086252
This commit is contained in:
Jingxiang Ge
2021-12-02 11:12:22 +08:00
committed by Madan Koyyalamudi
parent 8a62e5dcd9
commit 765f3289a1

View File

@@ -7853,6 +7853,13 @@ static int hdd_config_vdev_chains(struct hdd_adapter *adapter,
if (!tx_attr && !rx_attr)
return 0;
/* if one is present, both must be present */
if (!tx_attr || !rx_attr) {
hdd_err("Missing attribute for %s",
tx_attr ? "RX" : "TX");
return -EINVAL;
}
tx_chains = nla_get_u8(tx_attr);
rx_chains = nla_get_u8(rx_attr);
@@ -7876,6 +7883,13 @@ static int hdd_config_tx_rx_nss(struct hdd_adapter *adapter,
if (!tx_attr && !rx_attr)
return 0;
/* if one is present, both must be present */
if (!tx_attr || !rx_attr) {
hdd_err("Missing attribute for %s",
tx_attr ? "RX" : "TX");
return -EINVAL;
}
tx_nss = nla_get_u8(tx_attr);
rx_nss = nla_get_u8(rx_attr);
hdd_debug("tx_nss %d rx_nss %d", tx_nss, rx_nss);