Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 247ed618 authored by Wang Yufen's avatar Wang Yufen Committed by Greg Kroah-Hartman
Browse files

powerpc/pseries: fix potential memory leak in init_cpu_associativity()



[ Upstream commit 95f1a128cd728a7257d78e868f1f5a145fc43736 ]

If the vcpu_associativity alloc memory successfully but the
pcpu_associativity fails to alloc memory, the vcpu_associativity
memory leaks.

Fixes: d62c8dee ("powerpc/pseries: Provide vcpu dispatch statistics")
Signed-off-by: default avatarWang Yufen <wangyufen@huawei.com>
Reviewed-by: default avatar"Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/1671003983-10794-1-git-send-email-wangyufen@huawei.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent cee681d4
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -522,8 +522,10 @@ static ssize_t vcpudispatch_stats_write(struct file *file, const char __user *p,

	if (cmd) {
		rc = init_cpu_associativity();
		if (rc)
		if (rc) {
			destroy_cpu_associativity();
			goto out;
		}

		for_each_possible_cpu(cpu) {
			disp = per_cpu_ptr(&vcpu_disp_data, cpu);