Skip to content

Commit bba959f

Browse files
committed
Merge tag 'efi-fixes-for-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
Pull EFI fixes from Ard Biesheuvel: - Wipe screen_info after allocating it from the heap - used by arm32 and EFI zboot, other EFI architectures allocate it statically - Revert to allocating boot_params from the heap on x86 when entering via the native PE entrypoint, to work around a regression on older Dell hardware * tag 'efi-fixes-for-v6.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: x86/efistub: Revert to heap allocated boot_params for PE entrypoint efi/libstub: Zero initialize heap allocated struct screen_info
2 parents 9b21993 + ae835a9 commit bba959f

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

drivers/firmware/efi/libstub/screen_info.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ struct screen_info *__alloc_screen_info(void)
3232
if (status != EFI_SUCCESS)
3333
return NULL;
3434

35+
memset(si, 0, sizeof(*si));
36+
3537
status = efi_bs_call(install_configuration_table,
3638
&screen_info_guid, si);
3739
if (status == EFI_SUCCESS)

drivers/firmware/efi/libstub/x86-stub.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -534,11 +534,12 @@ void __noreturn efi_stub_entry(efi_handle_t handle,
534534
efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
535535
efi_system_table_t *sys_table_arg)
536536
{
537-
static struct boot_params boot_params __page_aligned_bss;
538-
struct setup_header *hdr = &boot_params.hdr;
539537
efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
538+
struct boot_params *boot_params;
539+
struct setup_header *hdr;
540540
int options_size = 0;
541541
efi_status_t status;
542+
unsigned long alloc;
542543
char *cmdline_ptr;
543544

544545
efi_system_table = sys_table_arg;
@@ -553,6 +554,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
553554
efi_exit(handle, status);
554555
}
555556

557+
status = efi_allocate_pages(PARAM_SIZE, &alloc, ULONG_MAX);
558+
if (status != EFI_SUCCESS)
559+
efi_exit(handle, status);
560+
561+
boot_params = memset((void *)alloc, 0x0, PARAM_SIZE);
562+
hdr = &boot_params->hdr;
563+
556564
/* Assign the setup_header fields that the kernel actually cares about */
557565
hdr->root_flags = 1;
558566
hdr->vid_mode = 0xffff;
@@ -562,13 +570,15 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
562570

563571
/* Convert unicode cmdline to ascii */
564572
cmdline_ptr = efi_convert_cmdline(image, &options_size);
565-
if (!cmdline_ptr)
573+
if (!cmdline_ptr) {
574+
efi_free(PARAM_SIZE, alloc);
566575
efi_exit(handle, EFI_OUT_OF_RESOURCES);
576+
}
567577

568578
efi_set_u64_split((unsigned long)cmdline_ptr, &hdr->cmd_line_ptr,
569-
&boot_params.ext_cmd_line_ptr);
579+
&boot_params->ext_cmd_line_ptr);
570580

571-
efi_stub_entry(handle, sys_table_arg, &boot_params);
581+
efi_stub_entry(handle, sys_table_arg, boot_params);
572582
/* not reached */
573583
}
574584

0 commit comments

Comments
 (0)