]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
loader/i386/linux: Fix cleanup if kernel doesn't support 64-bit addressing
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>
Fri, 1 Nov 2024 22:54:40 +0000 (00:54 +0200)
committerDaniel Kiper <daniel.kiper@oracle.com>
Wed, 26 Feb 2025 14:31:59 +0000 (15:31 +0100)
Simply returning from grub_cmd_linux() doesn't free "file" resource nor
calls grub_dl_ref(my_mod). Jump to "fail" label for proper cleanup like
other error checks do.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
grub-core/loader/i386/linux.c

index b051600c87ec5f3f8135beb34acd97a9c8f77efc..b7c1e057e14f18c3c10dc40bafa096793f07eaae 100644 (file)
@@ -838,9 +838,10 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
 #ifdef GRUB_MACHINE_EFI
 #ifdef __x86_64__
   if (grub_le_to_cpu16 (linux_params.version) < 0x0208 &&
-      ((grub_addr_t) grub_efi_system_table >> 32) != 0)
-    return grub_error(GRUB_ERR_BAD_OS,
-                     "kernel does not support 64-bit addressing");
+      ((grub_addr_t) grub_efi_system_table >> 32) != 0) {
+    grub_errno = grub_error (GRUB_ERR_BAD_OS, "kernel does not support 64-bit addressing");
+    goto fail;
+  }
 #endif
 
   if (grub_le_to_cpu16 (linux_params.version) >= 0x0208)