summaryrefslogtreecommitdiff
authorAo Xu <ao.xu@amlogic.com>2018-02-07 08:23:04 (GMT)
committer jie.yuan <jie.yuan@amlogic.com>2018-03-09 09:16:16 (GMT)
commit67e65a5da38ce6fca0006755117386c5aa6db217 (patch)
tree5ee13975217b35f5457f3094d58ec86319c1c68d
parentf147474d83e57cab17e523e2d5b2a3856ef97778 (diff)
downloadcommon-67e65a5da38ce6fca0006755117386c5aa6db217.zip
common-67e65a5da38ce6fca0006755117386c5aa6db217.tar.gz
common-67e65a5da38ce6fca0006755117386c5aa6db217.tar.bz2
kernel: workqueue: avoid process_one_work NULL reference[1/1]
PD#158184: avoid process_one_work NULL reference avoid process_one_work NULL reference Change-Id: I96d9477b804e079e18663d8f80d714ed9fbbd642 Signed-off-by: Ao Xu <ao.xu@amlogic.com>
Diffstat
-rw-r--r--kernel/workqueue.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 296dcca..10ec9c3 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2012,11 +2012,20 @@ static void process_one_work(struct worker *worker, struct work_struct *work)
__releases(&pool->lock)
__acquires(&pool->lock)
{
+#ifdef CONFIG_AMLOGIC_MODIFY
+ int work_color;
+ struct worker *collision;
+ bool cpu_intensive;
+ struct pool_workqueue *pwq = get_work_pwq(work);
+ struct worker_pool *pool = worker->pool;
+#else
struct pool_workqueue *pwq = get_work_pwq(work);
struct worker_pool *pool = worker->pool;
bool cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
int work_color;
struct worker *collision;
+#endif
+
#ifdef CONFIG_LOCKDEP
/*
* It is permissible to free the struct work_struct from
@@ -2029,6 +2038,14 @@ __acquires(&pool->lock)
lockdep_copy_map(&lockdep_map, &work->lockdep_map);
#endif
+#ifdef CONFIG_AMLOGIC_MODIFY
+ if (!pwq) {
+ WARN_ONCE(1, "Warning: pool_workqueue is NULL!!!!!!!!!!!!.\n");
+ return;
+ }
+
+ cpu_intensive = pwq->wq->flags & WQ_CPU_INTENSIVE;
+#endif
/* ensure we're on the correct CPU */
WARN_ON_ONCE(!(pool->flags & POOL_DISASSOCIATED) &&
raw_smp_processor_id() != pool->cpu);