Commit 1f61be00 authored by Namhyung Kim's avatar Namhyung Kim Committed by Steven Rostedt

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.orgSigned-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent a737e6dd
...@@ -2637,7 +2637,8 @@ ftrace_allocate_pages(unsigned long num_to_init) ...@@ -2637,7 +2637,8 @@ ftrace_allocate_pages(unsigned long num_to_init)
return start_pg; return start_pg;
free_pages: free_pages:
while (start_pg) { pg = start_pg;
while (pg) {
order = get_count_order(pg->size / ENTRIES_PER_PAGE); order = get_count_order(pg->size / ENTRIES_PER_PAGE);
free_pages((unsigned long)pg->records, order); free_pages((unsigned long)pg->records, order);
start_pg = pg->next; start_pg = pg->next;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment