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

commit 64e87d4bd3201bf8a4685083ee4daf5c0d001452 upstream.

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: 1bd2a63b4f ("x86/intel_rdt/mba_sc: Add initialization support")
Fixes: edf6fa1c4a ("x86/intel_rdt/cqm: Add RMID (Resource monitoring ID) management")
Signed-off-by: James Morse <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Acked-by: Reinette Chatre <[email protected]>
Cc: <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
James Morse 2021-09-17 16:59:58 +00:00 • committed by Greg Kroah-Hartman
commit 9264bd22d7

View file

@ -588,6 +588,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
}
if (r->mon_capable && domain_setup_mon_state(r, d)) {
kfree(d->ctrl_val);
kfree(d->mbps_val);
kfree(d);
return;
}