]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
[ 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

index d4b346355bb9eaea1b341bd57d34f13710c1148b..6d4ee03d476a95df5f365c67e143de5ecaef6391 100644 (file)
@@ -739,7 +739,6 @@ static int dlpar_cpu_add_by_count(u32 cpus_to_add)
        parent = of_find_node_by_path("/cpus");
        if (!parent) {
                pr_warn("Could not find CPU root node in device tree\n");
-               kfree(cpu_drcs);
                return -1;
        }