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 <[email protected]> Reviewed-by: "Naveen N. Rao" <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://msgid.link/[email protected]
1 parent 007240d commit 95f1a12

File tree

1 file changed

+3
-1
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+3
-1
lines changed

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)