summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2013-11-19 16:41:49 +0100
committerJiri Slaby <jslaby@suse.cz>2014-03-12 13:25:38 +0100
commita2198407845fa9d85b590eafafacf3b6a82d3528 (patch)
treedfd2e8780f9448a4496541c0ffc1a638502de8ba /kernel
parentec6317cc7e5e333acdfa2426c96d372bfc920077 (diff)
downloadlwn-a2198407845fa9d85b590eafafacf3b6a82d3528.tar.gz
lwn-a2198407845fa9d85b590eafafacf3b6a82d3528.zip
sched: Avoid NULL dereference on sd_busy
commit 42eb088ed246a5a817bb45a8b32fe234cf1c0f8b upstream. Commit 37dc6b50cee9 ("sched: Remove unnecessary iteration over sched domains to update nr_busy_cpus") forgot to clear 'sd_busy' under some conditions leading to a possible NULL deref in set_cpu_sd_state_idle(). Reported-by: Anton Blanchard <anton@samba.org> Cc: Preeti U Murthy <preeti@linux.vnet.ibm.com> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20131118113701.GF3866@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 6135b7c6bcfe..bc2f26d03751 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -5132,8 +5132,9 @@ static void update_top_cache_domain(int cpu)
if (sd) {
id = cpumask_first(sched_domain_span(sd));
size = cpumask_weight(sched_domain_span(sd));
- rcu_assign_pointer(per_cpu(sd_busy, cpu), sd->parent);
+ sd = sd->parent; /* sd_busy */
}
+ rcu_assign_pointer(per_cpu(sd_busy, cpu), sd);
rcu_assign_pointer(per_cpu(sd_llc, cpu), sd);
per_cpu(sd_llc_size, cpu) = size;