Pull EFI fixes from Ard Biesheuvel: - avoid a potential crash on the efi_subsys_init() error path - use more appropriate error code for runtime services calls issued after a crash in the firmware occurred - avoid READ_ONCE() for accessing firmware tables that may appear misaligned in memory * tag 'efi-fixes-for-v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi: efi: tpm: Avoid READ_ONCE() for accessing the event log efi: rt-wrapper: Add missing include efi: fix userspace infinite retry read efivars after EFI runtime services page fault efi: fix NULL-deref in init error path
Unified · Split
| @@ -4,6 +4,7 @@ · 3 unmodified lines | |||
| 4 | */ | 4 | */ |
| 5 | 5 | ||
| 6 | #include <linux/linkage.h> | 6 | #include <linux/linkage.h> |
| 7 | #include <asm/assembler.h> | ||
| 7 | 8 | ||
| 8 | SYM_FUNC_START(__efi_rt_asm_wrapper) | 9 | SYM_FUNC_START(__efi_rt_asm_wrapper) |
| 9 | stp x29, x30, [sp, #-112]! | 10 | stp x29, x30, [sp, #-112]! |
| @@ -394,8 +394,8 @@ static int __init efisubsys_init(void) · 393 unmodified lines | |||
| 394 | efi_kobj = kobject_create_and_add("efi", firmware_kobj); | 394 | efi_kobj = kobject_create_and_add("efi", firmware_kobj); |
| 395 | if (!efi_kobj) { | 395 | if (!efi_kobj) { |
| 396 | pr_err("efi: Firmware registration failed.\n"); | 396 | pr_err("efi: Firmware registration failed.\n"); |
| 397 | destroy_workqueue(efi_rts_wq); | 397 | error = -ENOMEM; |
| 398 | return -ENOMEM; | 398 | goto err_destroy_wq; |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE | | 401 | if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE | |
| @@ -443,7 +443,10 @@ err_unregister: · 41 unmodified lines | |||
| 443 | err_put: | 443 | err_put: |
| 444 | kobject_put(efi_kobj); | 444 | kobject_put(efi_kobj); |
| 445 | efi_kobj = NULL; | 445 | efi_kobj = NULL; |
| 446 | destroy_workqueue(efi_rts_wq); | 446 | err_destroy_wq: |
| 447 | if (efi_rts_wq) | ||
| 448 | destroy_workqueue(efi_rts_wq); | ||
| 449 | |||
| 447 | return error; | 450 | return error; |
| 448 | } | 451 | } |
| 449 | 452 | ||
| @@ -62,6 +62,7 @@ struct efi_runtime_work efi_rts_work; · 61 unmodified lines | |||
| 62 | \ | 62 | \ |
| 63 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) { \ | 63 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) { \ |
| 64 | pr_warn_once("EFI Runtime Services are disabled!\n"); \ | 64 | pr_warn_once("EFI Runtime Services are disabled!\n"); \ |
| 65 | efi_rts_work.status = EFI_DEVICE_ERROR; \ | ||
| 65 | goto exit; \ | 66 | goto exit; \ |
| 66 | } \ | 67 | } \ |
| 67 | \ | 68 | \ |
| @@ -198,8 +198,8 @@ static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *ev · 197 unmodified lines | |||
| 198 | * The loop below will unmap these fields if the log is larger than | 198 | * The loop below will unmap these fields if the log is larger than |
| 199 | * one page, so save them here for reference: | 199 | * one page, so save them here for reference: |
| 200 | */ | 200 | */ |
| 201 | count = READ_ONCE(event->count); | 201 | count = event->count; |
| 202 | event_type = READ_ONCE(event->event_type); | 202 | event_type = event->event_type; |
| 203 | 203 | ||
| 204 | /* Verify that it's the log header */ | 204 | /* Verify that it's the log header */ |
| 205 | if (event_header->pcr_idx != 0 || | 205 | if (event_header->pcr_idx != 0 || |