summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2014-05-05 19:12:20 +0200
committerIngo Molnar <mingo@kernel.org>2014-05-07 11:33:15 +0200
commitffb4ef21ac4308c2e738e6f83b6741bbc9b4fa3b (patch)
tree8fac0ed6e911159faa232d149a5d3113a2415ae2 /kernel
parentperf: Fix race in removing an event (diff)
downloadlinux-ffb4ef21ac4308c2e738e6f83b6741bbc9b4fa3b.tar.xz
linux-ffb4ef21ac4308c2e738e6f83b6741bbc9b4fa3b.zip
perf: Fix perf_event_init_context()
perf_pin_task_context() can return NULL but perf_event_init_context() assumes it will not, correct this. Reported-by: Vince Weaver <vincent.weaver@maine.edu> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Link: http://lkml.kernel.org/r/20140505171428.GU26782@laptop.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index ea899e2b5593..71232844f235 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7729,6 +7729,8 @@ int perf_event_init_context(struct task_struct *child, int ctxn)
* swapped under us.
*/
parent_ctx = perf_pin_task_context(parent, ctxn);
+ if (!parent_ctx)
+ return 0;
/*
* No need to check if parent_ctx != NULL here; since we saw