Skip to content

Commit

Permalink
x86/resctrl: Fix kfree() of the wrong type in domain_add_cpu()
Browse files Browse the repository at this point in the history
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: 792e0f6 ("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
  • Loading branch information
James Morse authored and Borislav Petkov committed Oct 6, 2021
1 parent 64e87d4 commit d4ebfca
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/kernel/cpu/resctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit d4ebfca

Please sign in to comment.