[tip:perf/core] oprofile, ARM: Release resources on failure

From: tip-bot for Robert Richter
Date: Sat Oct 16 2010 - 12:32:52 EST


Commit-ID: 81771974ae49bf79aab60c42eac7a6d730a9ef2b
Gitweb: http://git.kernel.org/tip/81771974ae49bf79aab60c42eac7a6d730a9ef2b
Author: Robert Richter <robert.richter@xxxxxxx>
AuthorDate: Wed, 29 Sep 2010 16:52:25 +0200
Committer: Robert Richter <robert.richter@xxxxxxx>
CommitDate: Mon, 11 Oct 2010 19:27:10 +0200

oprofile, ARM: Release resources on failure

This patch fixes a resource leak on failure, where the
oprofilefs and some counters may not released properly.

Signed-off-by: Robert Richter <robert.richter@xxxxxxx>
Acked-by: Will Deacon <will.deacon@xxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: <stable@xxxxxxxxxx> # .35.x
LKML-Reference: <20100929145225.GJ13563@xxxxxxxxxxxx>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
drivers/oprofile/oprofile_perf.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/oprofile/oprofile_perf.c b/drivers/oprofile/oprofile_perf.c
index ebb40cb..f3d3df2 100644
--- a/drivers/oprofile/oprofile_perf.c
+++ b/drivers/oprofile/oprofile_perf.c
@@ -84,6 +84,7 @@ static int op_create_counter(int cpu, int event)
if (IS_ERR(pevent)) {
ret = PTR_ERR(pevent);
} else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {
+ perf_event_release_kernel(pevent);
pr_warning("oprofile: failed to enable event %d "
"on CPU %d\n", event, cpu);
ret = -EBUSY;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/