]> git.baikalelectronics.ru Git - kernel.git/commitdiff
x86/resctrl: Free the ctrlval arrays when domain_setup_mon_state() fails
authorJames Morse <james.morse@arm.com>
Fri, 17 Sep 2021 16:59:58 +0000 (16:59 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Oct 2021 09:40:13 +0000 (11:40 +0200)
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: b5bcc17ddf518 ("x86/intel_rdt/mba_sc: Add initialization support")
Fixes: f9ebb9951a101 ("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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/resctrl/core.c

index 87a34b6e06a2bab0612310d4265afc997fbdbdb6..130c3c7f56d4b660ba46932b8eb62b33eb98e04d 100644 (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;
        }