tracing/uprobes: Fix uprobe_cpu_buffer memory leak

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>
This commit is contained in:
zhangwei(Jovi) 2014-04-17 16:05:19 +08:00 committed by Steven Rostedt
parent 5d6c97c559
commit 6ea6215fe3
1 changed files with 6 additions and 0 deletions

View File

@ -732,9 +732,15 @@ static int uprobe_buffer_enable(void)
static void uprobe_buffer_disable(void) static void uprobe_buffer_disable(void)
{ {
int cpu;
BUG_ON(!mutex_is_locked(&event_mutex)); BUG_ON(!mutex_is_locked(&event_mutex));
if (--uprobe_buffer_refcnt == 0) { 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); free_percpu(uprobe_cpu_buffer);
uprobe_cpu_buffer = NULL; uprobe_cpu_buffer = NULL;
} }