From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934470AbcBQMPL (ORCPT ); Wed, 17 Feb 2016 07:15:11 -0500 Received: from terminus.zytor.com ([198.137.202.10]:56127 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934186AbcBQMPG (ORCPT ); Wed, 17 Feb 2016 07:15:06 -0500 Date: Wed, 17 Feb 2016 04:11:56 -0800 From: tip-bot for Thomas Gleixner Message-ID: Cc: peterz@infradead.org, eranian@google.com, mingo@kernel.org, torvalds@linux-foundation.org, acme@redhat.com, vincent.weaver@maine.edu, linux-kernel@vger.kernel.org, jolsa@redhat.com, tglx@linutronix.de, hpa@zytor.com Reply-To: acme@redhat.com, torvalds@linux-foundation.org, mingo@kernel.org, eranian@google.com, peterz@infradead.org, hpa@zytor.com, tglx@linutronix.de, jolsa@redhat.com, linux-kernel@vger.kernel.org, vincent.weaver@maine.edu In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/amd/uncore: Plug reference leak Git-Commit-ID: 8bc9162cd2bf37036c486b384ac445b59b334b04 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 8bc9162cd2bf37036c486b384ac445b59b334b04 Gitweb: http://git.kernel.org/tip/8bc9162cd2bf37036c486b384ac445b59b334b04 Author: Thomas Gleixner AuthorDate: Tue, 16 Feb 2016 23:04:41 +0100 Committer: Ingo Molnar 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 Cc: Arnaldo Carvalho de Melo Cc: Jiri Olsa Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Vince Weaver Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1602162302170.19512@nanos Signed-off-by: Ingo Molnar --- 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; }