[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1217620879.15667.145.camel@carll-linux-desktop>
Date: Fri, 01 Aug 2008 13:01:19 -0700
From: Carl Love <cel@...ibm.com>
To: Arnd Bergmann <arnd@...db.de>, linuxppc-dev@...abs.org,
cel <cel@...ux.vnet.ibm.com>, cbe-oss-dev@...abs.org,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] Cell OProfile: SPU mutex lock fix, version 4
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>
Index: Cell_kernel_6_26_2008/drivers/oprofile/cpu_buffer.c
===================================================================
--- Cell_kernel_6_26_2008.orig/drivers/oprofile/cpu_buffer.c
+++ Cell_kernel_6_26_2008/drivers/oprofile/cpu_buffer.c
@@ -38,8 +38,12 @@ void free_cpu_buffers(void)
{
int i;
- for_each_online_cpu(i)
- vfree(per_cpu(cpu_buffer, i).buffer);
+ for_each_online_cpu(i) {
+ if (per_cpu(cpu_buffer, i).buffer) {
+ vfree(per_cpu(cpu_buffer, i).buffer);
+ per_cpu(cpu_buffer, i).buffer = NULL;
+ }
+ }
}
unsigned long oprofile_get_cpu_buffer_size(void)
Index: Cell_kernel_6_26_2008/drivers/oprofile/event_buffer.c
===================================================================
--- Cell_kernel_6_26_2008.orig/drivers/oprofile/event_buffer.c
+++ Cell_kernel_6_26_2008/drivers/oprofile/event_buffer.c
@@ -92,7 +92,10 @@ out:
void free_event_buffer(void)
{
- vfree(event_buffer);
+ if (event_buffer)
+ vfree(event_buffer);
+
+ event_buffer = NULL;
}
--
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