qcacmn: Validate existence of sch thread before posting a message

If scheduler thread thread doesn't exist or has been shutdown then
don't post a message otherwise it will cause a memory leak.

validate the existence of scheduler thread before posting a message.

Change-Id: Id0e75bdebc7db8c00d9efb8a6e8678491b21a20f
CRs-Fixed: 2031651
This commit is contained in:
Krunal Soni
2017-04-12 05:27:09 -07:00
committed by Sandeep Puligilla
parent 948ddd56e7
commit c8039e3fa4

View File

@@ -185,10 +185,13 @@ QDF_STATUS scheduler_post_msg_by_priority(QDF_MODULE_ID qid,
struct scheduler_msg_wrapper *msg_wrapper = NULL; struct scheduler_msg_wrapper *msg_wrapper = NULL;
struct scheduler_ctx *sched_ctx = scheduler_get_context(); struct scheduler_ctx *sched_ctx = scheduler_get_context();
if (!sched_ctx || !pMsg) { if (!sched_ctx || !pMsg || !sched_ctx->sch_thread) {
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR, QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
"%s: Null params or global sch context is null", "%s: Null params or global sch context is null",
__func__); __func__);
QDF_TRACE(QDF_MODULE_ID_SCHEDULER, QDF_TRACE_LEVEL_ERROR,
"%s: sched_ctx[%d], pMsg[%d]",
__func__, !!sched_ctx, !!pMsg);
QDF_ASSERT(0); QDF_ASSERT(0);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }