summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-03-28 13:13:56 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-14 13:02:14 -0700
commit80b9edca1c11ec8118ab30451af9c1d492770c90 (patch)
tree0165dcbe6f0ace2e0547327925b0f7329e2ee4dd
parentc43194250ee8bb20e2d6d1edba9553842a21679c (diff)
perf: Fix task_struct reference leak
commit fd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a upstream. sys_perf_event_open() had an imbalance in the number of task refs it took causing memory leakage Cc: Jiri Olsa <jolsa@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--kernel/perf_event.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index f81f9d6395a..07fcc8568fa 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5917,6 +5917,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):
*/