]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
x86/efistub: Avoid returning EFI_SUCCESS on error
authorArd Biesheuvel <ardb@kernel.org>
Thu, 4 Jul 2024 08:59:23 +0000 (10:59 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 3 Aug 2024 07:00:29 +0000 (09:00 +0200)
commit fb318ca0a522295edd6d796fb987e99ec41f0ee5 upstream.

The fail label is only used in a situation where the previous EFI API
call succeeded, and so status will be set to EFI_SUCCESS. Fix this, by
dropping the goto entirely, and call efi_exit() with the correct error
code.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/firmware/efi/libstub/x86-stub.c

index 1983fd3bf392e7ac09790d931b810f2de8b576f1..64f057c771af81c7e2cc22c8d351bd4610e11b70 100644 (file)
@@ -501,16 +501,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
        /* Convert unicode cmdline to ascii */
        cmdline_ptr = efi_convert_cmdline(image, &options_size);
        if (!cmdline_ptr)
-               goto fail;
+               efi_exit(handle, EFI_OUT_OF_RESOURCES);
 
        efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr,
                          &boot_params.ext_cmd_line_ptr);
 
        efi_stub_entry(handle, sys_table_arg, &boot_params);
        /* not reached */
-
-fail:
-       efi_exit(handle, status);
 }
 
 static void add_e820ext(struct boot_params *params,