From 1c6bb03362248b5f27a0b2ed30e5c0af99dfd2b9 Mon Sep 17 00:00:00 2001 From: Zhu Jianmin Date: Wed, 9 May 2018 20:28:25 +0800 Subject: [PATCH] qcacmn: Avoid timer double free when disable scheduler A global timer is created and freed by each module, if passed as msg to mc queues, shouldn't be freed in scheduler_cleanup_queues, or double free issue happens For example, a timer in tLimTimers is freed in mac_stop->pe_stop ->lim_cleanup_mlm Change-Id: I919b13f2570e3496a1de249fd90a88f3bfeaa131 CRs-Fixed: 2220514 --- scheduler/src/scheduler_core.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scheduler/src/scheduler_core.c b/scheduler/src/scheduler_core.c index 7436b2c2875f..04934907a91c 100644 --- a/scheduler/src/scheduler_core.c +++ b/scheduler/src/scheduler_core.c @@ -433,9 +433,16 @@ void scheduler_cleanup_queues(struct scheduler_ctx *sch_ctx, int idx) while ((msg_wrapper = scheduler_mq_get(&sch_ctx->queue_ctx.sch_msg_q[idx]))) { if (msg_wrapper->msg_buf) { - sched_info("Freeing MC WMA MSG message type %d", - msg_wrapper->msg_buf->type); - + if ((QDF_MODULE_ID_SYS == + sch_ctx->queue_ctx.sch_msg_q[idx].qid) && + (SYS_MSG_ID_MC_TIMER == + msg_wrapper->msg_buf->type)) { + sched_debug("Timer is freed by each module, not here"); + continue; + } + sched_info("Freeing MC MSG message type %d, module id:%d", + msg_wrapper->msg_buf->type, + sch_ctx->queue_ctx.sch_msg_q[idx].qid); if (msg_wrapper->msg_buf->flush_callback) { sched_debug("Flush callback called for type-%x", msg_wrapper->msg_buf->type);