summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-03-21 10:02:42 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-11-10 07:41:36 -0800
commit5796c70e5b1d62016bdc3b678346ffbd433d030a (patch)
tree1baacfa301e290c2cbc1ab64ba6181d52100e5cb /kernel
parent93e8e691675a33960b607d9fd0858d5a35f0e419 (diff)
perf/core: Don't leak event in the syscall error path
[ Upstream commit 201c2f85bd0bc13b712d9c0b3d11251b182e06ae ] In the error path, event_file not being NULL is used to determine whether the event itself still needs to be free'd, so fix it up to avoid leaking. Reported-by: Leon Yu <chianglungyu@gmail.com> Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Fixes: 130056275ade ("perf: Do not double free") Link: http://lkml.kernel.org/r/87twk06yxp.fsf@ashishki-desk.ger.corp.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/events/core.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 330fcd1b1822..19519ec39d51 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8532,6 +8532,7 @@ SYSCALL_DEFINE5(perf_event_open,
f_flags);
if (IS_ERR(event_file)) {
err = PTR_ERR(event_file);
+ event_file = NULL;
goto err_context;
}