Commit 64e87d4b authored by James Morse's avatar James Morse Committed by Borislav Petkov

x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails

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: 1bd2a63b ("x86/intel_rdt/mba_sc: Add initialization support")
Fixes: edf6fa1c ("x86/intel_rdt/cqm: Add RMID (Resource monitoring ID) management")
Signed-off-by: default avatarJames Morse <james.morse@arm.com>
Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
Acked-by: default avatarReinette Chatre <reinette.chatre@intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20210917165958.28313-1-james.morse@arm.com
parent 6e3cd952
...@@ -532,6 +532,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) ...@@ -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)) { if (r->mon_capable && domain_setup_mon_state(r, d)) {
kfree(hw_dom->ctrl_val);
kfree(hw_dom->mbps_val);
kfree(d); kfree(d);
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment