Skip to content

Commit

Permalink
powerpc/pseries: Fix possible leaked device node reference
Browse files Browse the repository at this point in the history
Failure return from dlpar_configure_connector when dlpar adding cpus
results in leaking references to the cpus parent device node. Move the
call to of_node_put() prior to checking the result of
dlpar_configure_connector.

Fixes: 8d5ff32 ("powerpc/pseries: Make dlpar_configure_connector parent node aware")

Signed-off-by: Nathan Fontenot <[email protected]>
Signed-off-by: Michael Ellerman <[email protected]>
  • Loading branch information
nfont authored and mpe committed May 11, 2015
1 parent 202648a commit 2222ce0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions arch/powerpc/platforms/pseries/dlpar.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,10 @@ static ssize_t dlpar_cpu_probe(const char *buf, size_t count)
return -ENODEV;

dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent);
of_node_put(parent);
if (!dn)
return -EINVAL;

of_node_put(parent);

rc = dlpar_attach_node(dn);
if (rc) {
dlpar_release_drc(drc_index);
Expand Down

0 comments on commit 2222ce0

Please sign in to comment.