[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cc20c5cc-cf8e-d125-cac9-5d1b938a1d86@linux.vnet.ibm.com>
Date: Tue, 19 Feb 2019 09:46:42 -0600
From: Michael Bringmann <mwb@...ux.vnet.ibm.com>
To: linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Rob Herring <robh@...nel.org>,
Tyrel Datwyler <tyreld@...ux.vnet.ibm.com>,
"Juliet M. Kim" <minkim@...ux.vnet.ibm.com>,
Nathan Lynch <nathanl@...ux.vnet.ibm.com>,
Thomas Falcon <tlfalcon@...ux.vnet.ibm.com>,
Michael Bringmann <mwb@...ux.vnet.ibm.com>
Subject: [PATCH] powerpc/pseries: Fix dn reference error in
dlpar_cpu_remove_by_index
powerpc/pseries: Fix dn reference error in dlpar_cpu_remove_by_index()
A reference to the device node of the CPU to be removed is released
upon successful removal of the associated CPU device. If the call
to remove the CPU device fails, dlpar_cpu_remove_by_index() still
frees the reference and this leads to miscomparisons and/or
addressing errors later on.
This problem may be observed when trying to DLPAR 'hot-remove' a CPU
from a system that has only a single CPU. The operation will fail
because there is no other CPU to which the kernel operations may be
migrated, but the refcount will still be decremented.
Signed-off-by: Michael Bringmann <mwb@...ux.vnet.ibm.com>
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 97feb6e..9537bb9 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -635,7 +635,8 @@ static int dlpar_cpu_remove_by_index(u32 drc_index)
}
rc = dlpar_cpu_remove(dn, drc_index);
- of_node_put(dn);
+ if (!rc)
+ of_node_put(dn);
return rc;
}
Powered by blists - more mailing lists