workqueue: Added null check and warning
If work item is already in queue get_work_cwq() will return null.
so null check is added to avoid crash in delayed_work_timer_on()
CRs-Fixed: 586162
Change-Id: I5c885142fd72781cea90d6c9b3456ecc7f0778b6
Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7da267c..4790c81 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -545,7 +545,10 @@
if (data & WORK_STRUCT_CWQ)
return (void *)(data & WORK_STRUCT_WQ_DATA_MASK);
else
+ {
+ WARN_ON_ONCE(1);
return NULL;
+ }
}
static struct global_cwq *get_work_gcwq(struct work_struct *work)
@@ -1101,7 +1104,8 @@
struct delayed_work *dwork = (struct delayed_work *)__data;
struct cpu_workqueue_struct *cwq = get_work_cwq(&dwork->work);
- __queue_work(smp_processor_id(), cwq->wq, &dwork->work);
+ if (cwq != NULL)
+ __queue_work(smp_processor_id(), cwq->wq, &dwork->work);
}
/**