Skip to content

Commit

Permalink
tracing/uprobes: Fix uprobe_cpu_buffer memory leak
Browse files Browse the repository at this point in the history
Forgot to free uprobe_cpu_buffer percpu page in uprobe_buffer_disable().

Link: http://lkml.kernel.org/p/534F8B3F.1090407@huawei.com

Cc: stable@vger.kernel.org # v3.14+
Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
  • Loading branch information
zhangwei(Jovi) authored and Steven Rostedt committed Apr 17, 2014
1 parent 5d6c97c commit 6ea6215
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/trace/trace_uprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -732,9 +732,15 @@ static int uprobe_buffer_enable(void)

static void uprobe_buffer_disable(void)
{
int cpu;

BUG_ON(!mutex_is_locked(&event_mutex));

if (--uprobe_buffer_refcnt == 0) {
for_each_possible_cpu(cpu)
free_page((unsigned long)per_cpu_ptr(uprobe_cpu_buffer,
cpu)->buf);

free_percpu(uprobe_cpu_buffer);
uprobe_cpu_buffer = NULL;
}
Expand Down

0 comments on commit 6ea6215

Please sign in to comment.