powerpc/pseries: Fix node leak in update_lmb_associativity_index()
authorMichael Ellerman <mpe@ellerman.id.au>
Tue, 27 Nov 2018 08:16:44 +0000 (19:16 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 14:37:47 +0000 (15:37 +0100)
[ Upstream commit 47918bc68b7427e961035949cc1501a864578a69 ]

In update_lmb_associativity_index() we lookup dr_node using
of_find_node_by_path() which takes a reference for us. In the
non-error case we forget to drop the reference. Note that
find_aa_index() does modify properties of the node, but doesn't need
an extra reference held once it's returned.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/platforms/pseries/hotplug-memory.c

index 99a3cf51c5ba421a09bf663ac9246bdabe4a2467..fdfce7a46d733f4b4b37e9b7fd08aaf06bbdf2b5 100644 (file)
@@ -295,6 +295,7 @@ static u32 lookup_lmb_associativity_index(struct of_drconf_cell *lmb)
 
        aa_index = find_aa_index(dr_node, ala_prop, lmb_assoc);
 
+       of_node_put(dr_node);
        dlpar_free_cc_nodes(lmb_node);
        return aa_index;
 }