Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1335887 > unrolled thread

[PATCH] x86/perf/amd_uncore: Plug reference leak

Started byThomas Gleixner <tglx@linutronix.de>
First post2016-02-16 23:10 +0100
Last post2016-02-17 13:20 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] x86/perf/amd_uncore: Plug reference leak Thomas Gleixner <tglx@linutronix.de> - 2016-02-16 23:10 +0100
    [tip:perf/core] perf/x86/amd/uncore: Plug reference leak tip-bot for Thomas Gleixner <tipbot@zytor.com> - 2016-02-17 13:20 +0100

#1335887 — [PATCH] x86/perf/amd_uncore: Plug reference leak

FromThomas Gleixner <tglx@linutronix.de>
Date2016-02-16 23:10 +0100
Subject[PATCH] x86/perf/amd_uncore: Plug reference leak
Message-ID<r2VYK-5w0-15@gated-at.bofh.it>
Subject: x86/perf/amd_uncore: Plug reference leak
From: Thomas Gleixner <tglx@linutronix.de>
Date: Wed, 03 Feb 2016 09:38:31 +0100

In the error path of amd_uncore_cpu_up_prepare() the newly allocated uncore
struct is freed, but the percpu pointer still references it. Set it to NULL.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 arch/x86/kernel/cpu/perf_event_amd_uncore.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/arch/x86/kernel/cpu/perf_event_amd_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
@@ -323,6 +323,8 @@ static int amd_uncore_cpu_up_prepare(uns
 	return 0;
 
 fail:
+	if (amd_uncore_nb)
+		*per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
 	kfree(uncore_nb);
 	return -ENOMEM;
 }

[toc] | [next] | [standalone]


#1336323 — [tip:perf/core] perf/x86/amd/uncore: Plug reference leak

Fromtip-bot for Thomas Gleixner <tipbot@zytor.com>
Date2016-02-17 13:20 +0100
Subject[tip:perf/core] perf/x86/amd/uncore: Plug reference leak
Message-ID<r39fk-6j5-17@gated-at.bofh.it>
In reply to#1335887
Commit-ID:  8bc9162cd2bf37036c486b384ac445b59b334b04
Gitweb:     http://git.kernel.org/tip/8bc9162cd2bf37036c486b384ac445b59b334b04
Author:     Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 16 Feb 2016 23:04:41 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 17 Feb 2016 08:36:09 +0100

perf/x86/amd/uncore: Plug reference leak

In the error path of amd_uncore_cpu_up_prepare() the newly allocated uncore
struct is freed, but the percpu pointer still references it. Set it to NULL.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
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: Vince Weaver <vincent.weaver@maine.edu>
Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1602162302170.19512@nanos
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/kernel/cpu/perf_event_amd_uncore.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
index 4974274..8836fc9 100644
--- a/arch/x86/kernel/cpu/perf_event_amd_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
@@ -323,6 +323,8 @@ static int amd_uncore_cpu_up_prepare(unsigned int cpu)
 	return 0;
 
 fail:
+	if (amd_uncore_nb)
+		*per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
 	kfree(uncore_nb);
 	return -ENOMEM;
 }

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web