[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a266736b-4d08-f5a0-887f-29ddfc8a3b72@intel.com>
Date: Tue, 21 Sep 2021 12:04:14 -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: Fix kfree() of the wrong type in
domain_add_cpu()
Hi James,
On 9/17/2021 9:59 AM, James Morse wrote:
> Commit 792e0f6f789b ("x86/resctrl: Split struct rdt_domain") separated
> the architecture specific and filesystem parts of the resctrl domain
> structures.
>
> This left the error paths in domain_add_cpu() kfree()ing the memory
> with the wrong type.
>
> This will cause a problem if someone adds a new member to struct
> rdt_hw_domain meaining d_resctrl is no longer the first member.
meaining -> meaning
>
> Fixes: 792e0f6f789b ("x86/resctrl: Split struct rdt_domain")
> Signed-off-by: James Morse <james.morse@....com>
> ---
> arch/x86/kernel/cpu/resctrl/core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c
> index b5de5a6c115c..bb1c3f5f60c8 100644
> --- a/arch/x86/kernel/cpu/resctrl/core.c
> +++ b/arch/x86/kernel/cpu/resctrl/core.c
> @@ -527,14 +527,14 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
> rdt_domain_reconfigure_cdp(r);
>
> if (r->alloc_capable && domain_setup_ctrlval(r, d)) {
> - kfree(d);
> + kfree(hw_dom);
> return;
> }
>
> if (r->mon_capable && domain_setup_mon_state(r, d)) {
> kfree(hw_dom->ctrl_val);
> kfree(hw_dom->mbps_val);
> - kfree(d);
> + kfree(hw_dom);
> return;
> }
>
>
Thank you very much.
Acked-by: Reinette Chatre <reinette.chatre@...el.com>
Reinette
Powered by blists - more mailing lists