Skip to content

Commit 95f1a12

Browse files
wangyufen316mpe
authored andcommitted
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: d62c8de ("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
1 parent 007240d commit 95f1a12

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • arch/powerpc/platforms/pseries

arch/powerpc/platforms/pseries/lpar.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,10 @@ static ssize_t vcpudispatch_stats_write(struct file *file, const char __user *p,
526526

527527
if (cmd) {
528528
rc = init_cpu_associativity();
529-
if (rc)
529+
if (rc) {
530+
destroy_cpu_associativity();
530531
goto out;
532+
}
531533

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

0 commit comments

Comments
 (0)