Skip to content

Commit 182da6f

Browse files
ardbiesheuvelrafaeljw
authored andcommitted
ACPI: PRM: Check whether EFI runtime is available
The ACPI PRM address space handler calls efi_call_virt_pointer() to execute PRM firmware code, but doing so is only permitted when the EFI runtime environment is available. Otherwise, such calls are guaranteed to result in a crash, and must therefore be avoided. Given that the EFI runtime services may become unavailable after a crash occurring in the firmware, we need to check this each time the PRM address space handler is invoked. If the EFI runtime services were not available at registration time to being with, don't install the address space handler at all. Fixes: cefc7ca ("ACPI: PRM: implement OperationRegion handler for the PlatformRtMechanism subtype") Signed-off-by: Ard Biesheuvel <[email protected]> Cc: All applicable <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 5dc4c99 commit 182da6f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/acpi/prmt.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
236236
efi_status_t status;
237237
struct prm_context_buffer context;
238238

239+
if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
240+
pr_err_ratelimited("PRM: EFI runtime services no longer available\n");
241+
return AE_NO_HANDLER;
242+
}
243+
239244
/*
240245
* The returned acpi_status will always be AE_OK. Error values will be
241246
* saved in the first byte of the PRM message buffer to be used by ASL.
@@ -325,6 +330,11 @@ void __init init_prmt(void)
325330

326331
pr_info("PRM: found %u modules\n", mc);
327332

333+
if (!efi_enabled(EFI_RUNTIME_SERVICES)) {
334+
pr_err("PRM: EFI runtime services unavailable\n");
335+
return;
336+
}
337+
328338
status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT,
329339
ACPI_ADR_SPACE_PLATFORM_RT,
330340
&acpi_platformrt_space_handler,

0 commit comments

Comments
 (0)