public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/perf/amd_uncore: Plug reference leak
@ 2016-02-16 22:04 Thomas Gleixner
  2016-02-17 12:11 ` [tip:perf/core] perf/x86/amd/uncore: " tip-bot for Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Gleixner @ 2016-02-16 22:04 UTC (permalink / raw)
  To: LKML; +Cc: Peter Zijlstra, x86, Jacob Shin, Borislav Petkov

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;
 }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-17 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-16 22:04 [PATCH] x86/perf/amd_uncore: Plug reference leak Thomas Gleixner
2016-02-17 12:11 ` [tip:perf/core] perf/x86/amd/uncore: " tip-bot for Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox