aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2010-09-10 11:38:06 -0400
committerIngo Molnar <mingo@elte.hu>2010-09-10 11:41:55 -0400
commite5f4d3394a52ac351f1a479fe136d92fa5228eff (patch)
tree57adeb66c5e98bf86613c15295e07cbb07952be3 /kernel
parentcee010ec5211b96f33c5c2208f5c14ebb04b634a (diff)
perf: Fix perf_init_event()
We ought to return -ENOENT when non of the registered PMUs recognise the requested event. This fixes a boot crash that occurs if no PMU is available but the NMI watchdog tries to register an event. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/perf_event.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f395fb4d9b74..f29b52576ec1 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5236,12 +5236,15 @@ struct pmu *perf_init_event(struct perf_event *event)
5236 list_for_each_entry_rcu(pmu, &pmus, entry) { 5236 list_for_each_entry_rcu(pmu, &pmus, entry) {
5237 int ret = pmu->event_init(event); 5237 int ret = pmu->event_init(event);
5238 if (!ret) 5238 if (!ret)
5239 break; 5239 goto unlock;
5240
5240 if (ret != -ENOENT) { 5241 if (ret != -ENOENT) {
5241 pmu = ERR_PTR(ret); 5242 pmu = ERR_PTR(ret);
5242 break; 5243 goto unlock;
5243 } 5244 }
5244 } 5245 }
5246 pmu = ERR_PTR(-ENOENT);
5247unlock:
5245 srcu_read_unlock(&pmus_srcu, idx); 5248 srcu_read_unlock(&pmus_srcu, idx);
5246 5249
5247 return pmu; 5250 return pmu;