aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2011-03-28 13:13:56 +0200
committerIngo Molnar <mingo@elte.hu>2011-03-31 13:02:56 +0200
commitfd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a (patch)
treeae456f2e42966042790809d7590c31736aa05557 /kernel
parentab711fe08297de1485fff0a366e6db8828cafd6a (diff)
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@redhat.com> Cc: Oleg Nesterov <oleg@redhat.com> Cc: stable@kernel.org # .37+ Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> LKML-Reference: <new-submission> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-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 261690923ff..27960f114ef 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):
*/