Skip to content

Commit

Permalink
perf events: Fix ring_buffer_wakeup() brown paperbag bug
Browse files Browse the repository at this point in the history
Commit 10c6db1 ("perf: Fix loss of notification with multi-event")
seems to unconditionally dereference event->rb in the wakeup handler,
this is wrong, there might not be a buffer attached.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20111213152651.GP20297@mudshark.cambridge.arm.com
[ minor edits ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Will Deacon authored and Ingo Molnar committed Dec 14, 2011
1 parent 373da0a commit 44b7f4b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kernel/events/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3558,9 +3558,13 @@ static void ring_buffer_wakeup(struct perf_event *event)

rcu_read_lock();
rb = rcu_dereference(event->rb);
list_for_each_entry_rcu(event, &rb->event_list, rb_entry) {
if (!rb)
goto unlock;

list_for_each_entry_rcu(event, &rb->event_list, rb_entry)
wake_up_all(&event->waitq);
}

unlock:
rcu_read_unlock();
}

Expand Down

0 comments on commit 44b7f4b

Please sign in to comment.