Patchwork [39/72] tracing: Fix double free when function profile init failed

login
register
mail settings
Submitter Luis Henriques
Date April 18, 2013, 9:16 a.m.
Message ID <1366276617-3553-40-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/237534/
State New
Headers show

Comments

Luis Henriques - April 18, 2013, 9:16 a.m.
3.5.7.11 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Namhyung Kim <namhyung.kim@lge.com>

commit 83e03b3fe4daffdebbb42151d5410d730ae50bd1 upstream.

On the failure path, stat->start and stat->pages will refer same page.
So it'll attempt to free the same page again and get kernel panic.

Link: http://lkml.kernel.org/r/1364820385-32027-1-git-send-email-namhyung@kernel.org

Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 kernel/trace/ftrace.c | 1 -
 1 file changed, 1 deletion(-)

Patch

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 00ea125..7da46c7 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -642,7 +642,6 @@  int ftrace_profile_pages_init(struct ftrace_profile_stat *stat)
 		free_page(tmp);
 	}
 
-	free_page((unsigned long)stat->pages);
 	stat->pages = NULL;
 	stat->start = NULL;