From 8d11564b56237bcda029457bd14899820f418ccb Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Wed, 31 Oct 2018 20:20:20 +0530 Subject: [PATCH] qcacld-3.0: Fix memory leak of sap_ctx->channelList In sap_deinit_ctx() the check to free sap_ctx->channelList is after sap_ctx is memset to 0 and thus sap_ctx->channelList will always be NULL and memory will never get freed. Also there is no need to reset scan_vdev_del_in_progress after vdev is deleted in firmware as there still can be the race when scan is processed. scan_vdev_del_in_progress will be deleted with obj_mgr vdev so no need to reset it. Change-Id: Ie5f133d4db48485434436e67ce1643d8e1e04106 CRs-Fixed: 2342039 --- core/hdd/src/wlan_hdd_main.c | 1 - core/sap/src/sap_module.c | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index e333410e38f7..3158c3c2f290 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3794,7 +3794,6 @@ int hdd_vdev_destroy(struct hdd_adapter *adapter) } release_vdev: - ucfg_scan_clear_vdev_del_in_progress(adapter->vdev); /* do vdev logical destroy via objmgr */ errno = hdd_objmgr_release_and_destroy_vdev(adapter); diff --git a/core/sap/src/sap_module.c b/core/sap/src/sap_module.c index d401e2a4674b..77adf76a8d35 100644 --- a/core/sap/src/sap_module.c +++ b/core/sap/src/sap_module.c @@ -357,17 +357,17 @@ QDF_STATUS sap_deinit_ctx(struct sap_context *sap_ctx) return QDF_STATUS_E_FAULT; } ucfg_scan_unregister_requester(pmac->psoc, sap_ctx->req_id); - sap_free_roam_profile(&sap_ctx->csr_roamProfile); - if (sap_ctx->sessionId != CSR_SESSION_ID_INVALID) { - /* empty queues/lists/pkts if any */ - sap_clear_session_param(hal, sap_ctx, sap_ctx->sessionId); - } if (sap_ctx->channelList) { qdf_mem_free(sap_ctx->channelList); sap_ctx->channelList = NULL; sap_ctx->num_of_channel = 0; } + sap_free_roam_profile(&sap_ctx->csr_roamProfile); + if (sap_ctx->sessionId != CSR_SESSION_ID_INVALID) { + /* empty queues/lists/pkts if any */ + sap_clear_session_param(hal, sap_ctx, sap_ctx->sessionId); + } return QDF_STATUS_SUCCESS; }