Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Carl Love and committed by
Paul Mackerras
f4156d1c 2bb2e1db

+5 -1
+3 -1
drivers/oprofile/cpu_buffer.c
··· 38 38 { 39 39 int i; 40 40 41 - for_each_online_cpu(i) 41 + for_each_online_cpu(i) { 42 42 vfree(per_cpu(cpu_buffer, i).buffer); 43 + per_cpu(cpu_buffer, i).buffer = NULL; 44 + } 43 45 } 44 46 45 47 int alloc_cpu_buffers(void)
+2
drivers/oprofile/event_buffer.c
··· 93 93 void free_event_buffer(void) 94 94 { 95 95 vfree(event_buffer); 96 + 97 + event_buffer = NULL; 96 98 } 97 99 98 100