diff options
author | Wang Yufen <wangyufen@huawei.com> | 2022-12-14 10:46:23 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2023-10-20 09:32:14 +0300 |
commit | 95f1a128cd728a7257d78e868f1f5a145fc43736 (patch) | |
tree | 3fb5faf56cfd15af0bb129222255836429830d89 /arch/powerpc | |
parent | 007240d59c11f87ac4f6cfc6a1d116630b6b634c (diff) | |
download | linux-95f1a128cd728a7257d78e868f1f5a145fc43736.tar.xz |
powerpc/pseries: fix potential memory leak in init_cpu_associativity()
If the vcpu_associativity alloc memory successfully but the
pcpu_associativity fails to alloc memory, the vcpu_associativity
memory leaks.
Fixes: d62c8deeb6e6 ("powerpc/pseries: Provide vcpu dispatch statistics")
Signed-off-by: Wang Yufen <wangyufen@huawei.com>
Reviewed-by: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/1671003983-10794-1-git-send-email-wangyufen@huawei.com
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/platforms/pseries/lpar.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index b4e86b7ea584..4561667832ed 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c @@ -526,8 +526,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); |