From: Peter Zijlstra Date: Mon, 28 Mar 2011 11:13:56 +0000 (+0200) Subject: perf: Fix task_struct reference leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fd1edb3aa2c1d92618d8f0c6d15d44ea41fcac6a;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Oleg Nesterov Cc: stable@kernel.org # .37+ Signed-off-by: Peter Zijlstra LKML-Reference: Signed-off-by: Ingo Molnar --- diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 261690923ffb..27960f114efd 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): */