diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2010-10-14 16:54:51 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2010-10-18 19:58:52 +0200 |
commit | e7d0bc047548d76feee6b23f7d3d9da927189a50 (patch) | |
tree | be1cd1fc48f6458a2efa4d0bfac53808938208dc /kernel | |
parent | 74c3337c2fc6389d3a57a622a936036b6db6b2e8 (diff) |
perf: Fix task refcount bugs
Currently it looks like find_lively_task_by_vpid() takes a task ref
and relies on find_get_context() to drop it.
The problem is that perf_event_create_kernel_counter() shouldn't be
dropping task refs.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Matt Helsley <matthltc@us.ibm.com>
LKML-Reference: <20101014203625.278436085@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/perf_event.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 346dc0e35a0..f928878a1c1 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -2190,11 +2190,9 @@ retry: } } - put_task_struct(task); return ctx; errout: - put_task_struct(task); return ERR_PTR(err); } @@ -5602,7 +5600,7 @@ SYSCALL_DEFINE5(perf_event_open, ctx = find_get_context(pmu, task, cpu); if (IS_ERR(ctx)) { err = PTR_ERR(ctx); - goto err_group_fd; + goto err_task; } /* @@ -5698,6 +5696,9 @@ SYSCALL_DEFINE5(perf_event_open, err_context: put_ctx(ctx); +err_task: + if (task) + put_task_struct(task); err_group_fd: fput_light(group_file, fput_needed); free_event(event); |