]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
powerpc/kexec: Fix loading of kernel + initramfs with kexec_file_load()
authorThiago Jung Bauermann <bauerman@linux.ibm.com>
Wed, 22 May 2019 22:01:58 +0000 (19:01 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Jun 2019 07:16:11 +0000 (09:16 +0200)
commite1801d51d673e1c9bbe0ded03bc9285f6d5a858d
treeab67529193de75478c0e95aac86e550891d72ec5
parent7229404941796558c387eee6f43989d750773cb2
powerpc/kexec: Fix loading of kernel + initramfs with kexec_file_load()

commit 8b909e3548706cbebc0a676067b81aadda57f47e upstream.

Commit b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
changed kexec_add_buffer() to skip searching for a memory location if
kexec_buf.mem is already set, and use the address that is there.

In powerpc code we reuse a kexec_buf variable for loading both the
kernel and the initramfs by resetting some of the fields between those
uses, but not mem. This causes kexec_add_buffer() to try to load the
kernel at the same address where initramfs will be loaded, which is
naturally rejected:

  # kexec -s -l --initrd initramfs vmlinuz
  kexec_file_load failed: Invalid argument

Setting the mem field before every call to kexec_add_buffer() fixes
this regression.

Fixes: b6664ba42f14 ("s390, kexec_file: drop arch_kexec_mem_walk()")
Cc: stable@vger.kernel.org # v5.0+
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
Reviewed-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/kernel/kexec_elf_64.c