Skip to content

Commit 2297339

Browse files
author
Mamatha Inamdar
committed
powerpc/xive: Fix refcount leak in xive_spapr_init
JIRA: https://issues.redhat.com/browse/RHEL-80849 CVE: CVE-2022-49437 commit 1d1fb96 Author: Miaoqian Lin <[email protected]> Date: Thu May 12 13:05:33 2022 +0400 powerpc/xive: Fix refcount leak in xive_spapr_init of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: eac1e73 ("powerpc/xive: guest exploitation of the XIVE interrupt controller") Signed-off-by: Miaoqian Lin <[email protected]> Reviewed-by: Cédric Le Goater <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mamatha Inamdar <[email protected]>
1 parent de4a758 commit 2297339

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/powerpc/sysdev/xive/spapr.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -829,12 +829,12 @@ bool __init xive_spapr_init(void)
829829
/* Resource 1 is the OS ring TIMA */
830830
if (of_address_to_resource(np, 1, &r)) {
831831
pr_err("Failed to get thread mgmnt area resource\n");
832-
return false;
832+
goto err_put;
833833
}
834834
tima = ioremap(r.start, resource_size(&r));
835835
if (!tima) {
836836
pr_err("Failed to map thread mgmnt area\n");
837-
return false;
837+
goto err_put;
838838
}
839839

840840
if (!xive_get_max_prio(&max_prio))
@@ -870,13 +870,16 @@ bool __init xive_spapr_init(void)
870870
if (!xive_core_init(np, &xive_spapr_ops, tima, TM_QW1_OS, max_prio))
871871
goto err_mem_free;
872872

873+
of_node_put(np);
873874
pr_info("Using %dkB queues\n", 1 << (xive_queue_shift - 10));
874875
return true;
875876

876877
err_mem_free:
877878
xive_irq_bitmap_remove_all();
878879
err_unmap:
879880
iounmap(tima);
881+
err_put:
882+
of_node_put(np);
880883
return false;
881884
}
882885

0 commit comments

Comments
 (0)