qcacld-3.0: Check mgmt_rx_params buffer before access

While handling WMI_MGMT_RX_EVENTID FW event, bufp should be checked before
used, because FW may indicate it as NULL.

System does not work when NULL pointer is accessed.

Change-Id: I7f87df93ee31332fa8c804cb2d7fd3a437ddf976
CRs-Fixed: 2465947
This commit is contained in:
bings 2019-06-19 17:38:10 +08:00 committed by nshrivas
parent acf277ac9a
commit 1289597e90

View File

@ -4283,9 +4283,11 @@ static int wma_mgmt_rx_process(void *handle, uint8_t *data,
return -EINVAL;
}
if (mgmt_rx_params->buf_len > data_len) {
WMA_LOGE("%s: Invalid rx mgmt packet, data_len %u, mgmt_rx_params->buf_len %u",
__func__, data_len, mgmt_rx_params->buf_len);
if (mgmt_rx_params->buf_len > data_len ||
!mgmt_rx_params->buf_len ||
!bufp) {
WMA_LOGE("Invalid data_len %u, buf_len %u bufp %pK",
data_len, mgmt_rx_params->buf_len, bufp);
qdf_mem_free(mgmt_rx_params);
return -EINVAL;
}