aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2016-02-16 17:04:41 -0500
committerIngo Molnar <mingo@kernel.org>2016-02-17 02:36:09 -0500
commit8bc9162cd2bf37036c486b384ac445b59b334b04 (patch)
treec2a9c71c53b0b5916c592b2d125ca4121fc5f9b3
parent65c23c65bee479faceb042a52f5a7278dfa8d972 (diff)
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>
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_uncore.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/kernel/cpu/perf_event_amd_uncore.c b/arch/x86/kernel/cpu/perf_event_amd_uncore.c
index 49742746a6c9..8836fc9fa84b 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)
323 return 0; 323 return 0;
324 324
325fail: 325fail:
326 if (amd_uncore_nb)
327 *per_cpu_ptr(amd_uncore_nb, cpu) = NULL;
326 kfree(uncore_nb); 328 kfree(uncore_nb);
327 return -ENOMEM; 329 return -ENOMEM;
328} 330}