[tip:perf/urgent] perf: Fix task_struct reference leak
From: tip-bot for Peter Zijlstra
Date: Thu Mar 31 2011 - 08:42:40 EST
Commit-ID: fd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a
Gitweb: http://git.kernel.org/tip/fd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a
Author: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
AuthorDate: Mon, 28 Mar 2011 13:13:56 +0200
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Thu, 31 Mar 2011 13:02:56 +0200
perf: Fix task_struct reference leak
sys_perf_event_open() had an imbalance in the number of task refs it
took causing memory leakage
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Oleg Nesterov <oleg@xxxxxxxxxx>
Cc: stable@xxxxxxxxxx # .37+
Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
kernel/perf_event.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 2616909..27960f1 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -6531,6 +6531,11 @@ SYSCALL_DEFINE5(perf_event_open,
goto err_alloc;
}
+ if (task) {
+ put_task_struct(task);
+ task = NULL;
+ }
+
/*
* Look up the group leader (we will attach this event to it):
*/
--
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/