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 | 6 | #include <linux/linkage.h> |
| 7 | +#include <asm/assembler.h> | |
| 7 | 8 | |
| 8 | 9 | SYM_FUNC_START(__efi_rt_asm_wrapper) |
| 9 | 10 | stp x29, x30, [sp, #-112]! |
| @@ -394,8 +394,8 @@ static int __init efisubsys_init(void) · 393 unmodified lines | ||
| 394 | 394 | efi_kobj = kobject_create_and_add("efi", firmware_kobj); |
| 395 | 395 | if (!efi_kobj) { |
| 396 | 396 | pr_err("efi: Firmware registration failed.\n"); |
| 397 | − destroy_workqueue(efi_rts_wq); | |
| 398 | − return -ENOMEM; | |
| 397 | + error = -ENOMEM; | |
| 398 | + goto err_destroy_wq; | |
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | if (efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE | |
| @@ -443,7 +443,10 @@ err_unregister: · 41 unmodified lines | ||
| 443 | 443 | err_put: |
| 444 | 444 | kobject_put(efi_kobj); |
| 445 | 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 | 450 | return error; |
| 448 | 451 | } |
| 449 | 452 | |
| @@ -62,6 +62,7 @@ struct efi_runtime_work efi_rts_work; · 61 unmodified lines | ||
| 62 | 62 | \ |
| 63 | 63 | if (!efi_enabled(EFI_RUNTIME_SERVICES)) { \ |
| 64 | 64 | pr_warn_once("EFI Runtime Services are disabled!\n"); \ |
| 65 | + efi_rts_work.status = EFI_DEVICE_ERROR; \ | |
| 65 | 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 | 198 | * The loop below will unmap these fields if the log is larger than |
| 199 | 199 | * one page, so save them here for reference: |
| 200 | 200 | */ |
| 201 | − count = READ_ONCE(event->count); | |
| 202 | − event_type = READ_ONCE(event->event_type); | |
| 201 | + count = event->count; | |
| 202 | + event_type = event->event_type; | |
| 203 | 203 | |
| 204 | 204 | /* Verify that it's the log header */ |
| 205 | 205 | if (event_header->pcr_idx != 0 || |