summaryrefslogtreecommitdiffstats
path: root/kernel/perf_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r--kernel/perf_event.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index 346dc0e35a0a..f928878a1c17 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);