perf: Fix NULL deref in inheritance code
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Wed, 30 Dec 2009 15:00:35 +0000 (16:00 +0100)
committerIngo Molnar <mingo@elte.hu>
Thu, 31 Dec 2009 12:11:31 +0000 (13:11 +0100)
commit05cbaa2853cdfc255fdd04e65a82bfe9208c4e52
tree83a6b8ea45fe181e623aa6c532cb9176400199de
parent48b5ba9cc98d676712da29d9931f1c88e5185ff2
perf: Fix NULL deref in inheritance code

Liming found a NULL deref when a task has a perf context but no
counters  when it forks.

This can occur in two cases, a race during construction where
the fork hits after installing the context but before the first
counter gets inserted, or more reproducably, a fork after the
last counter is closed (which leaves the context around).

Reported-by: Wang Liming <liming.wang@windriver.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
CC: <stable@kernel.org>
LKML-Reference: <1262185684.7135.222.camel@laptop>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
kernel/perf_event.c