x86/kexec: Fix double-free of elf header buffer
authorTakashi Iwai <tiwai@suse.de>
Tue, 22 Nov 2022 11:51:22 +0000 (12:51 +0100)
committerBorislav Petkov (AMD) <bp@alien8.de>
Mon, 2 Jan 2023 17:56:21 +0000 (18:56 +0100)
commitd00dd2f2645dca04cf399d8fc692f3f69b6dd996
treec00fb3eb128924a529b247d67797890549159517
parent88603b6dc419445847923fcb7fe5080067a30f98
x86/kexec: Fix double-free of elf header buffer

After

  b3e34a47f989 ("x86/kexec: fix memory leak of elf header buffer"),

freeing image->elf_headers in the error path of crash_load_segments()
is not needed because kimage_file_post_load_cleanup() will take
care of that later. And not clearing it could result in a double-free.

Drop the superfluous vfree() call at the error path of
crash_load_segments().

Fixes: b3e34a47f989 ("x86/kexec: fix memory leak of elf header buffer")
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Acked-by: Baoquan He <bhe@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: <stable@kernel.org>
Link: https://lore.kernel.org/r/20221122115122.13937-1-tiwai@suse.de
arch/x86/kernel/crash.c