[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1da649da-6527-d4c2-7d12-40126856ae75@intel.com>
Date: Thu, 19 Dec 2019 15:26:29 -0800
From: Reinette Chatre <reinette.chatre@...el.com>
To: Shakeel Butt <shakeelb@...gle.com>,
Fenghua Yu <fenghua.yu@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] x86/resctrl: Fix potential memory leak
Hi Shakeel,
On 12/19/2019 2:38 PM, Shakeel Butt wrote:
> The set_cache_qos_cfg() is leaking memory when the given level is not
> RDT_RESOURCE_L3 or RDT_RESOURCE_L2. Fix that.
I think it would be valuable to those considering whether they need to
backport to know that RDT_RESOURCE_L3 and RDT_RESOURCE_L2 are currently
the only possible levels with which this function is called. It is thus
not currently possible for this leak to occur. Indeed a valuable safety
to add in case this code may change in the future. Thank you very much.
>
> Fixes: 99adde9b370de ("x86/intel_rdt: Enable L2 CDP in MSR IA32_L2_QOS_CFG")
> Signed-off-by: Shakeel Butt <shakeelb@...gle.com>
> ---
> arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> index 2e3b06d6bbc6..a0c279c7f4b9 100644
> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
> @@ -1748,8 +1748,10 @@ static int set_cache_qos_cfg(int level, bool enable)
> update = l3_qos_cfg_update;
> else if (level == RDT_RESOURCE_L2)
> update = l2_qos_cfg_update;
> - else
> + else {
> + free_cpumask_var(cpu_mask);
> return -EINVAL;
> + }
>
> r_l = &rdt_resources_all[level];
> list_for_each_entry(d, &r_l->domains, list) {
>
Reinette
Powered by blists - more mailing lists