qcacld-3.0: Validate mac context in csr_get_peer_rssi_cb

Currently mac context is validated in csr_get_peer_rssi_cb
but even in case of invalid mac context it is dereferenced.

Add a check to validate the mac context and gracefully
return in case of invalid address

Change-Id: I96181e7ecd7be1a18e644f9499137a42e6af6372
CRs-Fixed: 2673557
This commit is contained in:
Ashish Kumar Dhanotiya 2020-04-28 11:48:32 +05:30 • committed by nshrivas
commit 4f8e207a80

View file

@ -6338,12 +6338,16 @@ static void csr_get_peer_rssi_cb(struct stats_event *ev, void *cookie)
{
struct mac_context *mac = (struct mac_context *)cookie;
if (!mac)
goto disconnect_stats_complete;
if (!mac) {
sme_err("Invalid mac ctx");
return;
}
if (!ev->peer_stats) {
sme_debug("%s no peer stats\n", __func__);
goto disconnect_stats_complete;
}
mac->peer_rssi = ev->peer_stats->peer_rssi;
mac->peer_txrate = ev->peer_stats->tx_rate;
mac->peer_rxrate = ev->peer_stats->rx_rate;