From 00f5651b66aa9acffeb754dd1110f8f1c13ddca3 Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Thu, 7 May 2020 09:38:51 +0530 Subject: [PATCH] qcacld-3.0: Remove validate context check in LL stats get NB ops As a part of LL stats get NB operation, the driver sends the LL stats req to the FW, waits for the response and sends back the stats in a synchronous reply. All this happens as a part of one single NB operation. Within this operation, if an rmmod comes, there can be a possiblity of a memory leak. In function hdd_link_layer_process_radio_stats, there is a check to validate the hdd_context and return if the driver is undergoing load/unload. As a part of the premature return, some memory are not freed properly. To resolve this, remove the validity check from the NB operation. The operation itself comes with DSC synchronization and ensures that the hdd_context remains valid atleast until the operation is complete. Thus there is no need for the redundant check of validity of hdd_context, which resolves the memory leak issue also. Change-Id: Ieea755e83addac99659dbd6e0e5f160b86e6f9fa CRs-Fixed: 2679081 --- core/hdd/src/wlan_hdd_stats.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_stats.c b/core/hdd/src/wlan_hdd_stats.c index 5ede83392f84..a51d9387ab1b 100644 --- a/core/hdd/src/wlan_hdd_stats.c +++ b/core/hdd/src/wlan_hdd_stats.c @@ -988,14 +988,16 @@ hdd_link_layer_process_radio_stats(struct hdd_adapter *adapter, struct wifi_radio_stats *radio_stat, u32 num_radio) { - int status, i, nr, ret; + int i, nr, ret; struct wifi_radio_stats *radio_stat_save = radio_stat; - struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); - - status = wlan_hdd_validate_context(hdd_ctx); - if (0 != status) - return; + /* + * There is no need for wlan_hdd_validate_context here. This is a NB + * operation that will come with DSC synchronization. This ensures that + * no driver transition will take place as long as this operation is + * not complete. Thus the need to check validity of hdd_context is not + * required. + */ for (i = 0; i < num_radio; i++) { hdd_nofl_debug("LL_STATS_RADIO"