All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <20100929145225.GJ13563@erda.amd.com>

diff --git a/a/1.txt b/N1/1.txt
index d643da2..4f78a95 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -17,3 +17,69 @@ Thanks,
 -Robert
 
 --
+
+>From 6cb93a9063c579ec0183406933bfe07e8cc92c34 Mon Sep 17 00:00:00 2001
+From: Robert Richter <robert.richter@amd.com>
+Date: Wed, 29 Sep 2010 16:03:11 +0200
+Subject: [PATCH] oprofile, arm: proper release resources on failure
+
+This patch fixes a resource leak on failure, where the oprofilefs and
+some counters may not released properly.
+
+Fix is also for 2.6.35-stable.
+
+Cc: Will Deacon <will.deacon@arm.com>
+Cc: stable@kernel.org
+Signed-off-by: Robert Richter <robert.richter@amd.com>
+---
+ arch/arm/oprofile/common.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
+index 0691176..72e09eb 100644
+--- a/arch/arm/oprofile/common.c
++++ b/arch/arm/oprofile/common.c
+@@ -102,6 +102,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;
+@@ -365,6 +366,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
+ 	ret = init_driverfs();
+ 	if (ret) {
+ 		kfree(counter_config);
++		counter_config = NULL;
+ 		return ret;
+ 	}
+ 
+@@ -402,7 +404,6 @@ void oprofile_arch_exit(void)
+ 	struct perf_event *event;
+ 
+ 	if (*perf_events) {
+-		exit_driverfs();
+ 		for_each_possible_cpu(cpu) {
+ 			for (id = 0; id < perf_num_counters; ++id) {
+ 				event = perf_events[cpu][id];
+@@ -413,8 +414,10 @@ void oprofile_arch_exit(void)
+ 		}
+ 	}
+ 
+-	if (counter_config)
++	if (counter_config) {
+ 		kfree(counter_config);
++		exit_driverfs();
++	}
+ }
+ #else
+ int __init oprofile_arch_init(struct oprofile_operations *ops)
+-- 
+1.7.2.2
+
+
+
+-- 
+Advanced Micro Devices, Inc.
+Operating System Research Center
diff --git a/a/content_digest b/N1/content_digest
index d1fdffa..c220b5e 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -1,7 +1,10 @@
- "From\0robert.richter@amd.com (Robert Richter)\0"
+ "From\0Robert Richter <robert.richter@amd.com>\0"
  "Subject\0[PATCH] oprofile, arm: proper release resources on failure\0"
  "Date\0Wed, 29 Sep 2010 16:52:25 +0200\0"
- "To\0linux-arm-kernel@lists.infradead.org\0"
+ "To\0Will Deacon <will.deacon@arm.com>"
+ " Ingo Molnar <mingo@elte.hu>\0"
+ "Cc\0LKML <linux-kernel@vger.kernel.org>"
+ " linux-arm-kernel@lists.infradead.org\0"
  "\00:1\0"
  "b\0"
  "Will,\n"
@@ -22,6 +25,72 @@
  "\n"
  "-Robert\n"
  "\n"
- --
+ "--\n"
+ "\n"
+ ">From 6cb93a9063c579ec0183406933bfe07e8cc92c34 Mon Sep 17 00:00:00 2001\n"
+ "From: Robert Richter <robert.richter@amd.com>\n"
+ "Date: Wed, 29 Sep 2010 16:03:11 +0200\n"
+ "Subject: [PATCH] oprofile, arm: proper release resources on failure\n"
+ "\n"
+ "This patch fixes a resource leak on failure, where the oprofilefs and\n"
+ "some counters may not released properly.\n"
+ "\n"
+ "Fix is also for 2.6.35-stable.\n"
+ "\n"
+ "Cc: Will Deacon <will.deacon@arm.com>\n"
+ "Cc: stable@kernel.org\n"
+ "Signed-off-by: Robert Richter <robert.richter@amd.com>\n"
+ "---\n"
+ " arch/arm/oprofile/common.c |    7 +++++--\n"
+ " 1 files changed, 5 insertions(+), 2 deletions(-)\n"
+ "\n"
+ "diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c\n"
+ "index 0691176..72e09eb 100644\n"
+ "--- a/arch/arm/oprofile/common.c\n"
+ "+++ b/arch/arm/oprofile/common.c\n"
+ "@@ -102,6 +102,7 @@ static int op_create_counter(int cpu, int event)\n"
+ " \tif (IS_ERR(pevent)) {\n"
+ " \t\tret = PTR_ERR(pevent);\n"
+ " \t} else if (pevent->state != PERF_EVENT_STATE_ACTIVE) {\n"
+ "+\t\tperf_event_release_kernel(pevent);\n"
+ " \t\tpr_warning(\"oprofile: failed to enable event %d \"\n"
+ " \t\t\t\t\"on CPU %d\\n\", event, cpu);\n"
+ " \t\tret = -EBUSY;\n"
+ "@@ -365,6 +366,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)\n"
+ " \tret = init_driverfs();\n"
+ " \tif (ret) {\n"
+ " \t\tkfree(counter_config);\n"
+ "+\t\tcounter_config = NULL;\n"
+ " \t\treturn ret;\n"
+ " \t}\n"
+ " \n"
+ "@@ -402,7 +404,6 @@ void oprofile_arch_exit(void)\n"
+ " \tstruct perf_event *event;\n"
+ " \n"
+ " \tif (*perf_events) {\n"
+ "-\t\texit_driverfs();\n"
+ " \t\tfor_each_possible_cpu(cpu) {\n"
+ " \t\t\tfor (id = 0; id < perf_num_counters; ++id) {\n"
+ " \t\t\t\tevent = perf_events[cpu][id];\n"
+ "@@ -413,8 +414,10 @@ void oprofile_arch_exit(void)\n"
+ " \t\t}\n"
+ " \t}\n"
+ " \n"
+ "-\tif (counter_config)\n"
+ "+\tif (counter_config) {\n"
+ " \t\tkfree(counter_config);\n"
+ "+\t\texit_driverfs();\n"
+ "+\t}\n"
+ " }\n"
+ " #else\n"
+ " int __init oprofile_arch_init(struct oprofile_operations *ops)\n"
+ "-- \n"
+ "1.7.2.2\n"
+ "\n"
+ "\n"
+ "\n"
+ "-- \n"
+ "Advanced Micro Devices, Inc.\n"
+ Operating System Research Center
 
-3092e8533451d2ae7cab20711b168ec0169a20914db08775471fc204eebf2aad
+3484e2698185db9fcc9ea5b74a2603a3d276dfbd3f4c02af7fb9c9a6393af1f6

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.