summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorJames Morse <james.morse@arm.com>2021-09-17 19:59:24 +0300
committerBorislav Petkov <bp@suse.de>2021-10-06 19:45:27 +0300
commitd4ebfca26dfab2803c31d68a30225be31b2f9ecf (patch)
treedad78126d785de3752998164f09543443df3aba8 /arch/x86
parent64e87d4bd3201bf8a4685083ee4daf5c0d001452 (diff)
downloadlinux-d4ebfca26dfab2803c31d68a30225be31b2f9ecf.tar.xz
x86/resctrl: Fix kfree() of the wrong type in domain_add_cpu()
Commit in Fixes 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 meaning d_resctrl is no longer the first member. Fixes: 792e0f6f789b ("x86/resctrl: Split struct rdt_domain") Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Reinette Chatre <reinette.chatre@intel.com> Link: https://lkml.kernel.org/r/20210917165924.28254-1-james.morse@arm.com
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/kernel/cpu/resctrl/core.c4
1 files 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;
}