]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
perf: Fix task_struct reference leak
authorPeter Zijlstra <a.p.zijlstra@chello.nl>
Mon, 28 Mar 2011 11:13:56 +0000 (13:13 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 14 Apr 2011 20:02:14 +0000 (13:02 -0700)
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>
kernel/perf_event.c

index f81f9d6395ad0326d4a3e9ac4d66bf9dcca3f159..07fcc8568fac8d6df1cb61a216f13cecf25fe96d 100644 (file)
@@ -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):
         */