Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/pseries: Fix possible leaked device node reference

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: 8d5ff320766f ("powerpc/pseries: Make dlpar_configure_connector parent node aware")

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Nathan Fontenot and committed by
Michael Ellerman
2222ce0f 202648a6

+1 -2
+1 -2
arch/powerpc/platforms/pseries/dlpar.c
··· 421 421 return -ENODEV; 422 422 423 423 dn = dlpar_configure_connector(cpu_to_be32(drc_index), parent); 424 + of_node_put(parent); 424 425 if (!dn) 425 426 return -EINVAL; 426 - 427 - of_node_put(parent); 428 427 429 428 rc = dlpar_attach_node(dn); 430 429 if (rc) {