tracing/uprobes: Fix uprobe_cpu_buffer memory leak
authorzhangwei(Jovi) <jovi.zhangwei@huawei.com>
Thu, 17 Apr 2014 08:05:19 +0000 (16:05 +0800)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 17 Apr 2014 14:44:42 +0000 (10:44 -0400)
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>
kernel/trace/trace_uprobe.c

index 930e51462dc871cf7bf038be265cc7ca281aad1c..c082a74413455da972d2c9c115001b58fe55e5a7 100644 (file)
@@ -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;
        }