提交 0b861225 编写于 作者: C Cyrill Gorcunov 提交者: Ingo Molnar

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: NCyrill 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: NIngo Molnar <mingo@elte.hu>
上级 a072738e
...@@ -1269,6 +1269,9 @@ int hw_perf_group_sched_in(struct perf_event *leader, ...@@ -1269,6 +1269,9 @@ int hw_perf_group_sched_in(struct perf_event *leader,
int assign[X86_PMC_IDX_MAX]; int assign[X86_PMC_IDX_MAX];
int n0, n1, ret; int n0, n1, ret;
if (!x86_pmu_initialized())
return 0;
/* n0 = total number of events */ /* n0 = total number of events */
n0 = collect_events(cpuc, leader, true); n0 = collect_events(cpuc, leader, true);
if (n0 < 0) if (n0 < 0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册