[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140212094930.GB3545@laptop.programming.kicks-ass.net>
Date: Wed, 12 Feb 2014 10:49:30 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: kbuild@...org, Ingo Molnar <mingo@...nel.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] sched: Fix rt/dl hotplug condition
Dan Carpenter reported:
> kernel/sched/rt.c:1347 pick_next_task_rt() warn: variable dereferenced before check 'prev' (see line 1338)
> kernel/sched/deadline.c:1011 pick_next_task_dl() warn: variable dereferenced before check 'prev' (see line 1005)
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Juri Lelli <juri.lelli@...il.com>
Fixes: 38033c37faab ("sched: Push down pre_schedule() and idle_balance()")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
---
kernel/sched/deadline.c | 2 +-
kernel/sched/rt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
index ed31ef66ab9d..d60008e4bce9 100644
--- a/kernel/sched/deadline.c
+++ b/kernel/sched/deadline.c
@@ -1001,7 +1001,7 @@ struct task_struct *pick_next_task_dl(struct rq *rq, struct task_struct *prev)
dl_rq = &rq->dl;
#ifdef CONFIG_SMP
- if (dl_task(prev))
+ if (prev && dl_task(prev))
pull_dl_task(rq);
#endif
diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index 72f9ec759972..7294b498b2c1 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -1334,7 +1334,7 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev)
#ifdef CONFIG_SMP
/* Try to pull RT tasks here if we lower this rq's prio */
- if (rq->rt.highest_prio.curr > prev->prio)
+ if (prev && (rq->rt.highest_prio.curr > prev->prio))
pull_rt_task(rq);
#endif
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists