Unload previous linux before updating the global variable kernel_size, otherwise the previous linux gets deallocated with the kernel_size of the linux that is being currently loaded.
Signed-off-by: Adriano Cordova <adriano.cord...@canonical.com> --- grub-core/loader/efi/linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c index 78ea07ca8..8ca06a373 100644 --- a/grub-core/loader/efi/linux.c +++ b/grub-core/loader/efi/linux.c @@ -489,6 +489,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), if (!file) goto fail; + grub_loader_unset(); + kernel_size = grub_file_size (file); if (grub_arch_efi_linux_load_image_header (file, &lh) != GRUB_ERR_NONE) @@ -511,8 +513,6 @@ fallback: } #endif - grub_loader_unset(); - grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size); kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size)); grub_dprintf ("linux", "kernel numpages: %lld\n", -- 2.48.1 _______________________________________________ Grub-devel mailing list Grub-devel@gnu.org https://lists.gnu.org/mailman/listinfo/grub-devel