summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2014-06-11 10:06:53 +0200
committerSteven Rostedt <rostedt@goodmis.org>2014-07-01 13:13:40 +0200
commit1f61be007e16a5d60b1cf868aa30d87f181e8e14 (patch)
treec35734b8355041e7bec6bf6ff9f4777abbc79fe5
parentftrace: Get rid of obsolete global_start_up variable (diff)
downloadlinux-1f61be007e16a5d60b1cf868aa30d87f181e8e14.tar.xz
linux-1f61be007e16a5d60b1cf868aa30d87f181e8e14.zip
ftrace: Fix memory leak on failure path in ftrace_allocate_pages()
As struct ftrace_page is managed in a single linked list, it should free from the start page. Link: http://lkml.kernel.org/p/1402474014-28655-1-git-send-email-namhyung@kernel.org Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel/trace/ftrace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 39df3192e725..e14ff4c1713e 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2637,7 +2637,8 @@ ftrace_allocate_pages(unsigned long num_to_init)
return start_pg;
free_pages:
- while (start_pg) {
+ pg = start_pg;
+ while (pg) {
order = get_count_order(pg->size / ENTRIES_PER_PAGE);
free_pages((unsigned long)pg->records, order);
start_pg = pg->next;