[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-4b24a88b35e15e04bd8f2c5dda65b5dc8ebca05f@git.kernel.org>
Date: Thu, 18 Mar 2010 19:21:37 GMT
From: tip-bot for Stephane Eranian <eranian@...gle.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, eranian@...gle.com, hpa@...or.com,
mingo@...hat.com, stable@...nel.org, tglx@...utronix.de,
mingo@...e.hu
Subject: [tip:perf/core] perf_events: Fix resource leak in x86 __hw_perf_event_init()
Commit-ID: 4b24a88b35e15e04bd8f2c5dda65b5dc8ebca05f
Gitweb: http://git.kernel.org/tip/4b24a88b35e15e04bd8f2c5dda65b5dc8ebca05f
Author: Stephane Eranian <eranian@...gle.com>
AuthorDate: Wed, 17 Mar 2010 23:21:01 +0200
Committer: Ingo Molnar <mingo@...e.hu>
CommitDate: Thu, 18 Mar 2010 18:39:40 +0100
perf_events: Fix resource leak in x86 __hw_perf_event_init()
If reserve_pmc_hardware() succeeds but reserve_ds_buffers()
fails, then we need to release_pmc_hardware. It won't be done
by the destroy() callback because we return before setting it
in case of error.
Signed-off-by: Stephane Eranian <eranian@...gle.com>
Cc: <stable@...nel.org>
Cc: peterz@...radead.org
Cc: paulus@...ba.org
Cc: davem@...emloft.net
Cc: fweisbec@...il.com
Cc: robert.richter@....com
Cc: perfmon2-devel@...ts.sf.net
LKML-Reference: <4ba1568b.15185e0a.182a.7802@...google.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
--
arch/x86/kernel/cpu/perf_event.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
arch/x86/kernel/cpu/perf_event.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 14eca80..f571f51 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -455,8 +455,11 @@ static int __hw_perf_event_init(struct perf_event *event)
if (atomic_read(&active_events) == 0) {
if (!reserve_pmc_hardware())
err = -EBUSY;
- else
+ else {
err = reserve_ds_buffers();
+ if (err)
+ release_pmc_hardware();
+ }
}
if (!err)
atomic_inc(&active_events);
--
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