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]
Date:   Tue, 21 Sep 2021 12:03:58 -0700
From:   Reinette Chatre <reinette.chatre@...el.com>
To:     James Morse <james.morse@....com>, <x86@...nel.org>,
        <linux-kernel@...r.kernel.org>
CC:     Fenghua Yu <fenghua.yu@...el.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        H Peter Anvin <hpa@...or.com>,
        Babu Moger <Babu.Moger@....com>,
        <shameerali.kolothum.thodi@...wei.com>,
        Jamie Iles <jamie@...iainc.com>,
        "D Scott Phillips OS" <scott@...amperecomputing.com>,
        <lcherian@...vell.com>, <bobo.shaobowang@...wei.com>
Subject: Re: [PATCH] x86/resctrl: Free the ctrlval arrays when
 domain_setup_mon_state() fails

Hi James,

On 9/17/2021 9:59 AM, James Morse wrote:
> domain_add_cpu() is called whenever a CPU is brought online. The
> earlier call to domain_setup_ctrlval() allocates the control value
> arrays.
> 
> If domain_setup_mon_state() fails, the control value arrays are not
> freed.
> 
> Add the missing kfree() calls.
> 
> Fixes: 1bd2a63b4f0de ("x86/intel_rdt/mba_sc: Add initialization support")
> Fixes: edf6fa1c4a951 ("x86/intel_rdt/cqm: Add RMID (Resource monitoring ID) management")
> Signed-off-by: James Morse <james.morse@....com>
> ---
> This will not apply prior to v5.15-rc1, I'll provide a backport.
> ~s/hw_dom/d/;
> ---
>   arch/x86/kernel/cpu/resctrl/core.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index 4b8813bafffd..b5de5a6c115c 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -532,6 +532,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
>   	}
>   
>   	if (r->mon_capable && domain_setup_mon_state(r, d)) {
> +		kfree(hw_dom->ctrl_val);
> +		kfree(hw_dom->mbps_val);
>   		kfree(d);
>   		return;
>   	}
> 

Thank you very much for catching and fixing this.

Acked-by: Reinette Chatre <reinette.chatre@...el.com>

Reinette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ