From: tip-bot for Cyrill Gorcunov <gorcunov@gmail.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, eranian@google.com,
acme@redhat.com, hpa@zytor.com, mingo@redhat.com,
gorcunov@openvz.org, peterz@infradead.org, gorcunov@gmail.com,
fweisbec@gmail.com, robert.richter@amd.com, ming.m.lin@intel.com,
tglx@linutronix.de, mingo@elte.hu
Subject: [tip:perf/x86] x86, perf: Fix NULL deref on not assigned x86_pmu
Date: Fri, 12 Mar 2010 09:54:42 GMT [thread overview]
Message-ID: <tip-0b861225a5890f22445f08ca9cc7a87cff276ff7@git.kernel.org> (raw)
In-Reply-To: <20100311215016.GG25162@lenovo>
Commit-ID: 0b861225a5890f22445f08ca9cc7a87cff276ff7
Gitweb: http://git.kernel.org/tip/0b861225a5890f22445f08ca9cc7a87cff276ff7
Author: Cyrill Gorcunov <gorcunov@gmail.com>
AuthorDate: Fri, 12 Mar 2010 00:50:16 +0300
Committer: Ingo Molnar <mingo@elte.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@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>
---
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)
next prev parent reply other threads:[~2010-03-12 9:55 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-10 18:31 [RFC] x86,perf: Implement minimal P4 PMU driver v14 Cyrill Gorcunov
2010-03-10 19:29 ` Robert Richter
2010-03-10 19:43 ` Cyrill Gorcunov
2010-03-11 2:32 ` Lin Ming
2010-03-11 4:12 ` Cyrill Gorcunov
2010-03-11 16:54 ` Cyrill Gorcunov
2010-03-11 18:16 ` Ingo Molnar
2010-03-11 18:29 ` Cyrill Gorcunov
2010-03-11 18:39 ` Ingo Molnar
2010-03-11 21:15 ` Cyrill Gorcunov
2010-03-11 21:24 ` Peter Zijlstra
2010-03-11 21:31 ` Cyrill Gorcunov
2010-03-11 21:38 ` Peter Zijlstra
2010-03-11 21:41 ` Cyrill Gorcunov
2010-03-11 21:50 ` Cyrill Gorcunov
2010-03-12 9:54 ` tip-bot for Cyrill Gorcunov [this message]
2010-03-11 18:33 ` [tip:perf/x86] perf, x86: Implement initial P4 PMU driver tip-bot for Cyrill Gorcunov
2010-03-16 16:07 ` Robert Richter
2010-03-16 16:23 ` Cyrill Gorcunov
2010-03-17 1:05 ` Lin Ming
2010-03-17 9:48 ` [tip:perf/core] perf, x86: Report error code that returned from x86_pmu.hw_config() tip-bot for Robert Richter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-0b861225a5890f22445f08ca9cc7a87cff276ff7@git.kernel.org \
--to=gorcunov@gmail.com \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@openvz.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox