[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200808110925.44243.arnd@arndb.de>
Date: Mon, 11 Aug 2008 09:25:43 +0200
From: Arnd Bergmann <arnd@...db.de>
To: linuxppc-dev@...abs.org
Cc: cbe-oss-dev@...abs.org, Robert Richter <robert.richter@....com>,
linux-kernel <linux-kernel@...r.kernel.org>,
oprofile-list@...ts.sf.net, Paul Mackerras <paulus@...ba.org>,
cel <cel@...ux.vnet.ibm.com>
Subject: powerpc/cell/oprofile: avoid double free of profile buffer
From: Carl Love <cel@...ibm.com>
If an error occurs on opcontrol start, the event and per cpu buffers
are released. If later opcontrol shutdown is called then the free
function will be called again to free buffers that no longer
exist. This results in a kernel oops. The following changes
prevent the call to delete buffers that don't exist.
Signed-off-by: Carl Love <carll@...ibm.com>
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
drivers/oprofile/cpu_buffer.c | 4 +++-
drivers/oprofile/event_buffer.c | 2 ++
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/oprofile/cpu_buffer.c b/drivers/oprofile/cpu_buffer.c
index b8601dc..366b5d2 100644
--- a/drivers/oprofile/cpu_buffer.c
+++ b/drivers/oprofile/cpu_buffer.c
@@ -38,8 +38,10 @@ void free_cpu_buffers(void)
{
int i;
- for_each_online_cpu(i)
+ for_each_online_cpu(i) {
vfree(per_cpu(cpu_buffer, i).buffer);
+ per_cpu(cpu_buffer, i).buffer = NULL;
+ }
}
unsigned long oprofile_get_cpu_buffer_size(void)
diff --git a/drivers/oprofile/event_buffer.c b/drivers/oprofile/event_buffer.c
index e7fbac5..8d692a5 100644
--- a/drivers/oprofile/event_buffer.c
+++ b/drivers/oprofile/event_buffer.c
@@ -93,6 +93,8 @@ out:
void free_event_buffer(void)
{
vfree(event_buffer);
+
+ event_buffer = NULL;
}
--
1.5.4.3
--
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