Skip to content

Commit

Permalink
powerpc/cell/oprofile: Avoid double vfree of profile buffer
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Carl Love authored and Paul Mackerras committed Aug 26, 2008
1 parent 2bb2e1d commit f4156d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/oprofile/cpu_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions drivers/oprofile/event_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ int alloc_event_buffer(void)
void free_event_buffer(void)
{
vfree(event_buffer);

event_buffer = NULL;
}


Expand Down

0 comments on commit f4156d1

Please sign in to comment.