diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-09-10 17:38:06 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-09-10 17:41:55 +0200 |
commit | e5f4d3394a52ac351f1a479fe136d92fa5228eff (patch) | |
tree | 57adeb66c5e98bf86613c15295e07cbb07952be3 | |
parent | cee010ec5211b96f33c5c2208f5c14ebb04b634a (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>
-rw-r--r-- | kernel/perf_event.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index f395fb4d9b7..f29b52576ec 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -5236,12 +5236,15 @@ struct pmu *perf_init_event(struct perf_event *event) list_for_each_entry_rcu(pmu, &pmus, entry) { int ret = pmu->event_init(event); if (!ret) - break; + goto unlock; + if (ret != -ENOENT) { pmu = ERR_PTR(ret); - break; + goto unlock; } } + pmu = ERR_PTR(-ENOENT); +unlock: srcu_read_unlock(&pmus_srcu, idx); return pmu; |