]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
powerpc/cell/oprofile: Avoid double vfree of profile buffer
authorCarl Love <cel@us.ibm.com>
Mon, 11 Aug 2008 07:25:43 +0000 (17:25 +1000)
committerPaul Mackerras <paulus@samba.org>
Tue, 26 Aug 2008 00:24:46 +0000 (10:24 +1000)
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@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
drivers/oprofile/cpu_buffer.c
drivers/oprofile/event_buffer.c

index 2450b3a393ff37f6ab1bd02d523f38027a838671..7ba78e6d210e72ac9b41395ccc25fb6b4bfcd658 100644 (file)
@@ -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;
+       }
 }
 
 int alloc_cpu_buffers(void)
index e7fbac5299354e485c4a4d98774ba4fc0ae7424c..8d692a5c8e73f730fa5a5417f73e149768627bc1 100644 (file)
@@ -93,6 +93,8 @@ out:
 void free_event_buffer(void)
 {
        vfree(event_buffer);
+
+       event_buffer = NULL;
 }