qcacmn: Fix memory leak in get_station_stats_cb

There is memory leak in get_station_stats_cb:
priv->vdev_summary_stats, priv->vdev_chain_rssi,
priv->peer_adv_stats. But the “request” is not leaked,
that means the “.dealloc” should be called.
The suspect is the get_station_stats_cb was called two
times with same cookie (request) before the "request"
was freed, that caused the priv->vdev_summary_stats
and the others two member of "priv" were overwritten,
and then memory leaks.

From the cp stats components there are multiple places
to call ucfg_mc_cp_stats_reset_pending_req to reset the
unused pending.req(has a cookie) to zero.  The zero
cookie may be used in again.

Change the ucfg_mc_cp_stats_reset_pending_req API to do
atomic operation of "reset" and "get" last pending
request.

Change-Id: I5efb7efec4da1edc0aab33b940dc126012a3f12e
CRs-Fixed: 2622444
Cette révision appartient à :
Liangwei Dong
2020-02-21 11:20:46 +08:00
révisé par nshrivas
Parent 28432f1195
révision 4f2b0feab6
4 fichiers modifiés avec 45 ajouts et 14 suppressions

Voir le fichier

@@ -461,6 +461,12 @@ static void get_station_stats_cb(struct stats_event *ev, void *cookie)
summary_size, rssi_size);
goto station_stats_cb_fail;
}
if (priv->vdev_summary_stats || priv->vdev_chain_rssi ||
priv->peer_adv_stats) {
osif_err("invalid context cookie %pK request %pK",
cookie, request);
goto station_stats_cb_fail;
}
priv->vdev_summary_stats = qdf_mem_malloc(summary_size);
if (!priv->vdev_summary_stats)