[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-0b861225a5890f22445f08ca9cc7a87cff276ff7@git.kernel.org>
Date: Fri, 12 Mar 2010 09:54:42 GMT
From: tip-bot for Cyrill Gorcunov <gorcunov@...il.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, acme@...hat.com,
hpa@...or.com, mingo@...hat.com, gorcunov@...nvz.org,
peterz@...radead.org, gorcunov@...il.com, fweisbec@...il.com,
robert.richter@....com, ming.m.lin@...el.com, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perf/x86] x86, perf: Fix NULL deref on not assigned x86_pmu
Commit-ID: 0b861225a5890f22445f08ca9cc7a87cff276ff7
Gitweb: http://git.kernel.org/tip/0b861225a5890f22445f08ca9cc7a87cff276ff7
Author: Cyrill Gorcunov <gorcunov@...il.com>
AuthorDate: Fri, 12 Mar 2010 00:50:16 +0300
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Fri, 12 Mar 2010 10:18:42 +0100
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@...nvz.org>
Cc: Lin Ming <ming.m.lin@...el.com>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Robert Richter <robert.richter@....com>
Cc: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
LKML-Reference: <20100311215016.GG25162@...ovo>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
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 e6a3f5f..5586a02 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,
int assign[X86_PMC_IDX_MAX];
int n0, n1, ret;
+ if (!x86_pmu_initialized())
+ return 0;
+
/* n0 = total number of events */
n0 = collect_events(cpuc, leader, true);
if (n0 < 0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists