Skip to content

Commit

Permalink
x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails
Browse files Browse the repository at this point in the history
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: 1bd2a63 ("x86/intel_rdt/mba_sc: Add initialization support")
Fixes: edf6fa1 ("x86/intel_rdt/cqm: Add RMID (Resource monitoring ID) management")
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>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20210917165958.28313-1-james.morse@arm.com
  • Loading branch information
James Morse authored and Borislav Petkov committed Oct 6, 2021
1 parent 6e3cd95 commit 64e87d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/x86/kernel/cpu/resctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 64e87d4

Please sign in to comment.