From e52fa917b9a4e694a47eb1efab947c42151ae08b Mon Sep 17 00:00:00 2001 From: hangtian Date: Mon, 26 Nov 2018 15:44:38 +0800 Subject: [PATCH] qcacld-3.0: Fix uninitialized issue while BMI failed Initialize gp_cds_context->cfg_ctx before any error case happened and goto err_wma_close. Otherwise, in wma_wmi_service_close, it's trying to free uninitialized gp_cds_context->cfg_ctx. Change-Id: I822ecf77676b9d638c414afb544fdb41d7b1d146 CRs-Fixed: 2355042 --- core/cds/src/cds_api.c | 1 + core/wma/src/wma_main.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/cds/src/cds_api.c b/core/cds/src/cds_api.c index 8009829404..3399f31f41 100644 --- a/core/cds/src/cds_api.c +++ b/core/cds/src/cds_api.c @@ -601,6 +601,7 @@ QDF_STATUS cds_open(struct wlan_objmgr_psoc *psoc) ucfg_mlme_set_sap_max_peers(psoc, cds_cfg->max_station); HTCHandle = cds_get_context(QDF_MODULE_ID_HTC); + gp_cds_context->cfg_ctx = NULL; if (!HTCHandle) { cds_alert("HTCHandle is null!"); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 49319972ab..9390787770 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -4673,7 +4673,8 @@ QDF_STATUS wma_wmi_service_close(void) /* free the wma_handle */ cds_free_context(QDF_MODULE_ID_WMA, wma_handle); - qdf_mem_free(((struct cds_context *) cds_ctx)->cfg_ctx); + if (((struct cds_context *)cds_ctx)->cfg_ctx) + qdf_mem_free(((struct cds_context *)cds_ctx)->cfg_ctx); ((struct cds_context *)cds_ctx)->cfg_ctx = NULL; WMA_LOGD("%s: Exit", __func__); return QDF_STATUS_SUCCESS;