perf: Fix task_struct reference leak
authorPeter Zijlstra <[email protected]>
Mon, 28 Mar 2011 11:13:56 +0000 (13:13 +0200)
committerIngo Molnar <[email protected]>
Thu, 31 Mar 2011 11:02:56 +0000 (13:02 +0200)
sys_perf_event_open() had an imbalance in the number of task refs it
took causing memory leakage

Cc: Jiri Olsa <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: [email protected] # .37+
Signed-off-by: Peter Zijlstra <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/perf_event.c

index 261690923ffb77d2060ac0a0dadeb4a716522917..27960f114efd73f9fb6ebec3d90952a643cd4284 100644 (file)
@@ -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):
         */