Skip to content

Commit

Permalink
powerpc/pseries: Fix parent_dn reference leak in add_dt_node()
Browse files Browse the repository at this point in the history
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: 8d5ff32 ("powerpc/pseries: Make dlpar_configure_connector parent node aware")
Cc: [email protected] # v3.12+
Signed-off-by: Tyrel Datwyler <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
Tyrel Datwyler authored and mpe committed Sep 21, 2017
1 parent 087ff6a commit b537ca6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion arch/powerpc/platforms/pseries/mobility.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
return -ENOENT;

dn = dlpar_configure_connector(drc_index, parent_dn);
if (!dn)
if (!dn) {
of_node_put(parent_dn);
return -ENOENT;
}

rc = dlpar_attach_node(dn, parent_dn);
if (rc)
Expand Down

0 comments on commit b537ca6

Please sign in to comment.