diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2010-03-11 16:50:16 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-03-12 04:18:42 -0500 |
commit | 0b861225a5890f22445f08ca9cc7a87cff276ff7 (patch) | |
tree | 324ff942381746878090b8a22128c532dd7ffcbd | |
parent | a072738e04f0eb26370e39ec679e9a0d65e49aea (diff) |
x86, perf: Fix NULL deref on not assigned x86_pmu
In case of not assigned x86_pmu and software events NULL dereference may
being hit via x86_pmu::schedule_events method.
Fix it by checking if x86_pmu is initialized at all.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20100311215016.GG25162@lenovo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index e6a3f5f81c96..5586a02067d8 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1269,6 +1269,9 @@ int hw_perf_group_sched_in(struct perf_event *leader, | |||
1269 | int assign[X86_PMC_IDX_MAX]; | 1269 | int assign[X86_PMC_IDX_MAX]; |
1270 | int n0, n1, ret; | 1270 | int n0, n1, ret; |
1271 | 1271 | ||
1272 | if (!x86_pmu_initialized()) | ||
1273 | return 0; | ||
1274 | |||
1272 | /* n0 = total number of events */ | 1275 | /* n0 = total number of events */ |
1273 | n0 = collect_events(cpuc, leader, true); | 1276 | n0 = collect_events(cpuc, leader, true); |
1274 | if (n0 < 0) | 1277 | if (n0 < 0) |