Skip to content

Commit

Permalink
perf: Fix task_struct reference leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Mar 31, 2011
1 parent ab711fe commit fd1edb3
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -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):
*/
Expand Down

0 comments on commit fd1edb3

Please sign in to comment.