Commit b537ca6f authored by Tyrel Datwyler's avatar Tyrel Datwyler Committed by Michael Ellerman

powerpc/pseries: Fix parent_dn reference leak in add_dt_node()

A reference to the parent device node is held by add_dt_node() for the
node to be added. If the call to dlpar_configure_connector() fails
add_dt_node() returns ENOENT and that reference is not freed.

Add a call to of_node_put(parent_dn) prior to bailing out after a
failed dlpar_configure_connector() call.

Fixes: 8d5ff320 ("powerpc/pseries: Make dlpar_configure_connector parent node aware")
Cc: stable@vger.kernel.org # v3.12+
Signed-off-by: default avatarTyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 087ff6a5
...@@ -226,8 +226,10 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index) ...@@ -226,8 +226,10 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
return -ENOENT; return -ENOENT;
dn = dlpar_configure_connector(drc_index, parent_dn); dn = dlpar_configure_connector(drc_index, parent_dn);
if (!dn) if (!dn) {
of_node_put(parent_dn);
return -ENOENT; return -ENOENT;
}
rc = dlpar_attach_node(dn, parent_dn); rc = dlpar_attach_node(dn, parent_dn);
if (rc) if (rc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment