Commit e7d0bc04 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
Acked-by: default avatarMatt Helsley <matthltc@us.ibm.com>
LKML-Reference: <20101014203625.278436085@chello.nl>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 74c3337c
...@@ -2190,11 +2190,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, int cpu) ...@@ -2190,11 +2190,9 @@ find_get_context(struct pmu *pmu, struct task_struct *task, int cpu)
} }
} }
put_task_struct(task);
return ctx; return ctx;
errout: errout:
put_task_struct(task);
return ERR_PTR(err); return ERR_PTR(err);
} }
...@@ -5602,7 +5600,7 @@ SYSCALL_DEFINE5(perf_event_open, ...@@ -5602,7 +5600,7 @@ SYSCALL_DEFINE5(perf_event_open,
ctx = find_get_context(pmu, task, cpu); ctx = find_get_context(pmu, task, cpu);
if (IS_ERR(ctx)) { if (IS_ERR(ctx)) {
err = PTR_ERR(ctx); err = PTR_ERR(ctx);
goto err_group_fd; goto err_task;
} }
/* /*
...@@ -5698,6 +5696,9 @@ SYSCALL_DEFINE5(perf_event_open, ...@@ -5698,6 +5696,9 @@ SYSCALL_DEFINE5(perf_event_open,
err_context: err_context:
put_ctx(ctx); put_ctx(ctx);
err_task:
if (task)
put_task_struct(task);
err_group_fd: err_group_fd:
fput_light(group_file, fput_needed); fput_light(group_file, fput_needed);
free_event(event); free_event(event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment