lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.11.1603020859490.3638@nanos>
Date:	Wed, 2 Mar 2016 09:00:20 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Vikas Shivappa <vikas.shivappa@...ux.intel.com>
cc:	vikas.shivappa@...el.com, linux-kernel@...r.kernel.org,
	x86@...nel.org, hpa@...or.com, mingo@...nel.org,
	peterz@...radead.org, ravi.v.shankar@...el.com,
	tony.luck@...el.com, fenghua.yu@...el.com, h.peter.anvin@...el.com
Subject: Re: [PATCH 2/6] x86,perf/cqm: Fix cqm memory leak and notifier
 leak

On Tue, 1 Mar 2016, Vikas Shivappa wrote:

> Fixes the hotcpu notifier leak and a memory leak during cqm(cache
> quality of service monitoring) initialization.
> 
> Reviewed-by: Tony Luck <tony.luck@...el.com>
> Signed-off-by: Vikas Shivappa <vikas.shivappa@...ux.intel.com>
> ---
>  arch/x86/kernel/cpu/perf_event_intel_cqm.c | 17 ++++++++++++-----
>  1 file changed, 12 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/perf_event_intel_cqm.c b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
> index e6be335..5666171 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel_cqm.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel_cqm.c
> @@ -1322,7 +1322,7 @@ static const struct x86_cpu_id intel_cqm_match[] = {
>  
>  static int __init intel_cqm_init(void)
>  {
> -	char *str, scale[20];
> +	char *str = NULL, scale[20];
>  	int i, cpu, ret;
>  
>  	if (!x86_match_cpu(intel_cqm_match))
> @@ -1382,16 +1382,23 @@ static int __init intel_cqm_init(void)
>  		cqm_pick_event_reader(i);
>  	}
>  
> -	__perf_cpu_notifier(intel_cqm_cpu_notifier);
> -
>  	ret = perf_pmu_register(&intel_cqm_pmu, "intel_cqm", -1);
> -	if (ret)
> +	if (ret) {
>  		pr_err("Intel CQM perf registration failed: %d\n", ret);
> -	else
> +		goto out;
> +	} else {
>  		pr_info("Intel CQM monitoring enabled\n");
> +	}
>  
> +	/*
> +	 * Register the hot cpu notifier once we are sure cqm
> +	 * is enabled to avoid notifier leak.
> +	 */
> +	__perf_cpu_notifier(intel_cqm_cpu_notifier);
>  out:
>  	cpu_notifier_register_done();
> +	if (ret)
> +		kfree(str);

This still leaks cqm_rmid_ptrs ....

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ