Skip to content

Commit

Permalink
profile: fix stats and data leakage
Browse files Browse the repository at this point in the history
If the kernel is large or the profiling step small, /proc/profile
leaks data and readprofile shows silly stats, until readprofile -r
has reset the buffer: clear the prof_buffer when it is vmalloc()ed.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Hugh Dickins authored and torvalds committed May 15, 2010
1 parent bfcc6e2 commit 16a2164
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/profile.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ int __ref profile_init(void)
return 0;

prof_buffer = vmalloc(buffer_bytes);
if (prof_buffer)
if (prof_buffer) {
memset(prof_buffer, 0, buffer_bytes);
return 0;
}

free_cpumask_var(prof_cpu_mask);
return -ENOMEM;
Expand Down

0 comments on commit 16a2164

Please sign in to comment.