summaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-09-13 11:15:58 +0200
committerIngo Molnar <mingo@elte.hu>2010-09-13 17:08:42 +0200
commit0c67b40872326a5340cab51d79a192a5fbaeb484 (patch)
treee92b420dcb1375e159842d8ffa03a5230976ab3a /kernel/perf_event.c
parentcde8e88498c8de69271fcb6d4dd974979368fa67 (diff)
downloadlinux-0c67b40872326a5340cab51d79a192a5fbaeb484.tar.bz2
perf: Fix free_event()
With the context rework stuff we can actually end up freeing an event before it gets attached to a context. Reported-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index bc46bff69620..440f9ca067b2 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -2150,7 +2150,9 @@ static void free_event(struct perf_event *event)
if (event->destroy)
event->destroy(event);
- put_ctx(event->ctx);
+ if (event->ctx)
+ put_ctx(event->ctx);
+
call_rcu(&event->rcu_head, free_event_rcu);
}