Re: [PATCH 0/3] stop OProfile calling arch_exit when arch_init fails

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Robert Richter
Date: Tuesday, August 31, 2010 - 4:01 am

On 29.08.10 14:51:58, Will Deacon wrote:

I have applied patch #1 and #2 to

 git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile.git core

with some small modifications:

Patch #1: Commit message, x86 removed.
Patch #2: Order of freeing memory:

+out:
+       if (ret) {
+               for_each_possible_cpu(cpu)
+                       kfree(perf_events[cpu]);
+               kfree(counter_config);
+       }
+

There is also the patch below on top of it.

Thanks Will,

-Robert

--

From 4cbe75be5c6ae86bdc7daec864eeb2dfd66f48bb Mon Sep 17 00:00:00 2001
From: Robert Richter <robert.richter@amd.com>
Date: Mon, 30 Aug 2010 18:21:55 +0200
Subject: [PATCH] oprofile, arm: initialize perf_event pointers with NULL

The pointers must be NULL'ed to avoid double-freeing the pointers in
rare cases during reinitialization.

Signed-off-by: Robert Richter <robert.richter@amd.com>
---
 arch/arm/oprofile/common.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index c3652f7..d660cb8 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -351,6 +351,8 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
 {
 	int cpu, ret = 0;
 
+	memset(&perf_events, 0, sizeof(perf_events));
+
 	perf_num_counters = armpmu_get_max_events();
 
 	counter_config = kcalloc(perf_num_counters,
-- 
1.7.1.1


-- 
Advanced Micro Devices, Inc.
Operating System Research Center

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 0/3] stop OProfile calling arch_exit when arch_ ..., Robert Richter, (Tue Aug 31, 4:01 am)