]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
powerpc/kernel: Fix unbalanced refcount on RTAS device node
authorGavin Shan <gwshan@linux.vnet.ibm.com>
Mon, 23 Jan 2017 22:49:54 +0000 (09:49 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 25 Jan 2017 02:34:21 +0000 (13:34 +1100)
The RTAS device-tree node's refcount has been increased by one in
the function call of_find_node_by_name(), but it's missed to be
decreased by one in the error path. It leads to unbalanced refcount
on RTAS device-tree node.

This fixes above issue by decreasing RTAS device-tree node's refcount
in error path.

Signed-off-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/rtas.c

index ba5a4cc0e5b6f6e55142d78728ea08d5137ee644..b8a4987f58cfdc6ccd66a94d68eea419bc68a37c 100644 (file)
@@ -1158,6 +1158,7 @@ void __init rtas_initialize(void)
        no_base = of_property_read_u32(rtas.dev, "linux,rtas-base", &base);
        no_size = of_property_read_u32(rtas.dev, "rtas-size", &size);
        if (no_base || no_size) {
+               of_node_put(rtas.dev);
                rtas.dev = NULL;
                return;
        }