Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'efi-fixes-for-v6.2-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

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

+10 -5
+1
arch/arm64/kernel/efi-rt-wrapper.S
··· 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]!
+6 -3
drivers/firmware/efi/efi.c
··· 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 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
+1
drivers/firmware/efi/runtime-wrappers.c
··· 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 \
+2 -2
include/linux/tpm_eventlog.h
··· 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 ||