Skip to content

Commit 129e715

Browse files
committed
Merge tag 'efi-urgent-for-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi
Pull EFI fixes from Ard Biesheuvel: - Use the right variable to check for shim insecure mode - Wipe setup_data field when booting via EFI - Add missing error check to efibc driver * tag 'efi-urgent-for-v6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efi: libstub: check Shim mode using MokSBStateRT efi: x86: Wipe setup_data on pure EFI boot efi: efibc: Guard against allocation failure
2 parents 5e0a93e + 5f56a74 commit 129e715

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

drivers/firmware/efi/efibc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ static int efibc_reboot_notifier_call(struct notifier_block *notifier,
4848
return NOTIFY_DONE;
4949

5050
wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL);
51+
if (!wdata)
52+
return NOTIFY_DONE;
53+
5154
for (l = 0; l < MAX_DATA_LEN - 1 && str[l] != '\0'; l++)
5255
wdata[l] = str[l];
5356
wdata[l] = L'\0';

drivers/firmware/efi/libstub/secureboot.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
/* SHIM variables */
1616
static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID;
17-
static const efi_char16_t shim_MokSBState_name[] = L"MokSBState";
17+
static const efi_char16_t shim_MokSBState_name[] = L"MokSBStateRT";
1818

1919
static efi_status_t get_var(efi_char16_t *name, efi_guid_t *vendor, u32 *attr,
2020
unsigned long *data_size, void *data)
@@ -43,8 +43,8 @@ enum efi_secureboot_mode efi_get_secureboot(void)
4343

4444
/*
4545
* See if a user has put the shim into insecure mode. If so, and if the
46-
* variable doesn't have the runtime attribute set, we might as well
47-
* honor that.
46+
* variable doesn't have the non-volatile attribute set, we might as
47+
* well honor that.
4848
*/
4949
size = sizeof(moksbstate);
5050
status = get_efi_var(shim_MokSBState_name, &shim_guid,
@@ -53,7 +53,7 @@ enum efi_secureboot_mode efi_get_secureboot(void)
5353
/* If it fails, we don't care why. Default to secure */
5454
if (status != EFI_SUCCESS)
5555
goto secure_boot_enabled;
56-
if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate == 1)
56+
if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate == 1)
5757
return efi_secureboot_mode_disabled;
5858

5959
secure_boot_enabled:

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
516516
hdr->ramdisk_image = 0;
517517
hdr->ramdisk_size = 0;
518518

519+
/*
520+
* Disregard any setup data that was provided by the bootloader:
521+
* setup_data could be pointing anywhere, and we have no way of
522+
* authenticating or validating the payload.
523+
*/
524+
hdr->setup_data = 0;
525+
519526
efi_stub_entry(handle, sys_table_arg, boot_params);
520527
/* not reached */
521528

0 commit comments

Comments
 (0)