Skip to content

Commit

Permalink
perf: Fix free_event()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Sep 13, 2010
1 parent cde8e88 commit 0c67b40
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 0c67b40

Please sign in to comment.