Преглед изворни кода

qcacld-3.0: Free already allocated memory for radio stats

Currently driver issues ll_stats command without considering
that there could be previously allocated memory which is not
freed because of timeout.
FW can send radio stats with multiple events and for the first
event host allocates memory in wma and processes all the events
with this memory, there is a possibility that host receives first
event and gets timed out, time out host frees the allocated
memory. Now if host receives remaining events it will again
allocate memory and processes these events and will set
nr_received as 1. Now if host issue new ll_stats request to FW,
in response processing it don't allocates new memory and just
appends new stats and increaments nr_received when nr_received
becomes equal to number of radios, it calls the hdd callback
and completes the request and frees the memory, after that host
receives the next event of this request and will allocates the
memory similar to above process and this event will be completed
as part of the response of the next ll_stats request, similar to
above process. This scenario will always have memory for one
radio stats response as non-freed which leads to memleak
issues.

To addrerss above issue, before sending any new ll_stats request
to FW, free the memory allocated for previous event.

Change-Id: I4bfd5bcb62416c243aa6023382070cbd993655c7
CRs-Fixed: 2961638
Ashish Kumar Dhanotiya пре 3 година
родитељ
комит
289ed99c0c
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      core/hdd/src/wlan_hdd_stats.c

+ 14 - 0
core/hdd/src/wlan_hdd_stats.c

@@ -1919,6 +1919,20 @@ static int wlan_hdd_send_ll_stats_req(struct hdd_adapter *adapter,
 
 	hdd_enter_dev(adapter->dev);
 
+	/*
+	 * FW can send radio stats with multiple events and for the first event
+	 * host allocates memory in wma and processes the events, there is a
+	 * possibility that host receives first event and gets timed out, on
+	 * time out host frees the allocated memory. now if host receives
+	 * remaining events it will again allocate memory and processes the
+	 * stats, since this is not an allocation for new command, this will
+	 * lead to out of order processing of the next event and this memory
+	 * might not be freed, so free the already allocated memory from WMA
+	 * before issuing any new ll stats request free memory allocated for
+	 * previous command
+	 */
+	sme_radio_tx_mem_free();
+
 	status = wlan_hdd_set_station_stats_request_pending(adapter);
 	if (status == QDF_STATUS_E_ALREADY)
 		return qdf_status_to_os_return(status);