qcacld-3.0: Fix chain_stats memory illegal access

chain_stats in WMI_UPDATE_STATS_EVENTID_param_tlvs may be set as
NULL by wlan firmware.

When access chain_stats, make sure it is not NULL.

Change-Id: I3a78534899a3a56f378c4825ff5b8abedb543b8c
CRs-Fixed: 2102247
This commit is contained in:
bings 2017-08-31 08:05:54 +08:00 • committed by snandini
commit f904765f82

View file

@ -2942,14 +2942,16 @@ int wma_stats_event_handler(void *handle, uint8_t *cmd_param_info,
rssi_event =
(wmi_per_chain_rssi_stats *) param_buf->chain_stats;
if (rssi_event && (rssi_event->num_per_chain_rssi_stats >
((WMI_SVC_MSG_MAX_SIZE - sizeof(*event)) /
sizeof(*peer_stats)))) {
excess_data = true;
break;
} else {
buf_len += rssi_event->num_per_chain_rssi_stats *
sizeof(*peer_stats);
if (rssi_event) {
if (rssi_event->num_per_chain_rssi_stats >
((WMI_SVC_MSG_MAX_SIZE - sizeof(*event)) /
sizeof(*rssi_event))) {
excess_data = true;
break;
} else {
buf_len += sizeof(*rssi_event) *
rssi_event->num_per_chain_rssi_stats;
}
}
} while (0);