summaryrefslogtreecommitdiff
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>2016-05-04 14:49:14 -0700
commit4eca34694d9b4f0a8aeb41c153c73b7efed9eb17 (patch)
treee9e4f15785ea5deccf137376d0c96e91c33365e3
parenta3b5912c041dc973d7fa64e97f66bb7fafa7028a (diff)
downloadlwn-4eca34694d9b4f0a8aeb41c153c73b7efed9eb17.tar.gz
lwn-4eca34694d9b4f0a8aeb41c153c73b7efed9eb17.zip
perf/core: Don't leak event in the syscall error path
commit 201c2f85bd0bc13b712d9c0b3d11251b182e06ae upstream. 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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-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 f0b4b328d8f5..7a7f6802d6f5 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -8479,6 +8479,7 @@ SYSCALL_DEFINE5(perf_event_open,
f_flags);
if (IS_ERR(event_file)) {
err = PTR_ERR(event_file);
+ event_file = NULL;
goto err_context;
}