lkml.org 
[lkml]   [2021]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails
From
Date
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@arm.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@intel.com>

Reinette

\
 
 \ /
  Last update: 2021-09-21 21:05    [W:0.172 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site