From: Peter Zijlstra Date: Mon, 13 Sep 2010 09:15:58 +0000 (+0200) Subject: perf: Fix free_event() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0c67b40872326a5340cab51d79a192a5fbaeb484;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Peter Zijlstra LKML-Reference: Signed-off-by: Ingo Molnar --- 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); }