浏览代码

powerpc/cell/oprofile: Avoid double vfree of profile buffer

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>
Carl Love 17 年之前
父节点
当前提交
f4156d1cd1
共有 2 个文件被更改,包括 5 次插入1 次删除
  1. 3 1
      drivers/oprofile/cpu_buffer.c
  2. 2 0
      drivers/oprofile/event_buffer.c

+ 3 - 1
drivers/oprofile/cpu_buffer.c

@@ -38,8 +38,10 @@ void free_cpu_buffers(void)
 {
 {
 	int i;
 	int i;
  
  
-	for_each_online_cpu(i)
+	for_each_online_cpu(i) {
 		vfree(per_cpu(cpu_buffer, i).buffer);
 		vfree(per_cpu(cpu_buffer, i).buffer);
+		per_cpu(cpu_buffer, i).buffer = NULL;
+	}
 }
 }
 
 
 int alloc_cpu_buffers(void)
 int alloc_cpu_buffers(void)

+ 2 - 0
drivers/oprofile/event_buffer.c

@@ -93,6 +93,8 @@ out:
 void free_event_buffer(void)
 void free_event_buffer(void)
 {
 {
 	vfree(event_buffer);
 	vfree(event_buffer);
+
+	event_buffer = NULL;
 }
 }