From: Frederic Weisbecker on
If we call free_event on fail case of event creation, it
already put the context. The falldown goto, though, also
does a put_ctx, which might dereference a freed context.

Signed-off-by: Frederic Weisbecker <fweisbec(a)gmail.com>
Cc: Ingo Molnar <mingo(a)elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra(a)chello.nl>
Cc: Arnaldo Carvalho de Melo <acme(a)redhat.com>
Cc: Paul Mackerras <paulus(a)samba.org>
Cc: Stephane Eranian <eranian(a)google.com>
Cc: Will Deacon <will.deacon(a)arm.com>
Cc: David Miller <davem(a)davemloft.net>
Cc: Paul Mundt <lethal(a)linux-sh.org>
Cc: Borislav Petkov <bp(a)amd64.org>
---
kernel/perf_event.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index b6e854f..925b53e 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -5364,6 +5364,8 @@ SYSCALL_DEFINE5(perf_event_open,

err_free_put_context:
free_event(event);
+ fput_light(group_file, fput_needed);
+ goto err_fd;
err_put_context:
fput_light(group_file, fput_needed);
put_ctx(ctx);
--
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/