[for-next][PATCH 15/21] ftrace: Fix memory leak on failure path in ftrace_allocate_pages()

From: Steven Rostedt
Date: Thu Jul 03 2014 - 12:15:58 EST


From: Namhyung Kim <namhyung@xxxxxxxxxx>

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@xxxxxxxxxx

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
Signed-off-by: Steven Rostedt <rostedt@xxxxxxxxxxx>
---
kernel/trace/ftrace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

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;
--
2.0.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/