powerpc/pseries/hotplug-cpu: Remove double free in error path
authorNathan Lynch <nathanl@linux.ibm.com>
Thu, 19 Sep 2019 23:16:33 +0000 (18:16 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Aug 2020 06:24:03 +0000 (08:24 +0200)
commit86a403273436ff935310567e932d9d8468b8e216
treea5e5adc9b92b8335c81f5b054bc5b7fca3e8eff5
parent2f121f384267a9d00aa7dcd14c980bcb8b5b8dde
powerpc/pseries/hotplug-cpu: Remove double free in error path

[ Upstream commit a0ff72f9f5a780341e7ff5e9ba50a0dad5fa1980 ]

In the unlikely event that the device tree lacks a /cpus node,
find_dlpar_cpus_to_add() oddly frees the cpu_drcs buffer it has been
passed before returning an error. Its only caller also frees the
buffer on error.

Remove the less conventional kfree() of a caller-supplied buffer from
find_dlpar_cpus_to_add().

Fixes: 90edf184b9b7 ("powerpc/pseries: Add CPU dlpar add functionality")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20190919231633.1344-1-nathanl@linux.ibm.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/powerpc/platforms/pseries/hotplug-cpu.c