Messages in this thread Patch in this message | | | Date | Fri, 19 Feb 2016 15:37:45 +0100 | From | Peter Zijlstra <> | Subject | [RFC][PATCH 2/7] perf: Do not double free |
| |
In case of: err_file: fput(event_file), we'll end up calling perf_release() which in turn will free the event.
Do not then free the event _again_.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- kernel/events/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
--- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -8520,7 +8520,12 @@ SYSCALL_DEFINE5(perf_event_open, perf_unpin_context(ctx); put_ctx(ctx); err_alloc: - free_event(event); + /* + * If event_file is set, the fput() above will have called ->release() + * and that will take care of freeing the event. + */ + if (!event_file) + free_event(event); err_cpus: put_online_cpus(); err_task:
| |