Skip to content

Commit

Permalink
powerpc/pseries/hotplug-cpu: Remove double free in error path
Browse files Browse the repository at this point in the history
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: 90edf18 ("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
  • Loading branch information
Nathan Lynch authored and Michael Ellerman committed Jul 30, 2020
1 parent 5d8b1f9 commit a0ff72f
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion arch/powerpc/platforms/pseries/hotplug-cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,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;
}

Expand Down

0 comments on commit a0ff72f

Please sign in to comment.