From fe6e62f50f9dfccfc204c28813eb08ff38bd808b Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Mon, 22 Oct 2018 16:18:41 -0700 Subject: [PATCH] qcacld-3.0: Reset cfg_ctx to NULL after its freed Reset cfg_ctx to NULL after its freed to avoid any use after free. Change-Id: Iff0eb6f6db5a1467913cebd09a424776ed3390c1 CRs-Fixed: 2337050 --- core/wma/src/wma_main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 47c6f55a630c..3b52e2a2bd95 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -3678,6 +3678,7 @@ err_event_init: err_scn_context: qdf_mem_free(((struct cds_context *) cds_context)->cfg_ctx); + ((struct cds_context *)cds_context)->cfg_ctx = NULL; OS_FREE(wmi_handle); err_wma_handle: @@ -4624,6 +4625,7 @@ QDF_STATUS wma_wmi_service_close(void) cds_free_context(QDF_MODULE_ID_WMA, wma_handle); 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; }