[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_3A33B864BD5DC73CBBE10CB481E4C546E107@qq.com>
Date: Tue, 8 Jul 2025 05:39:21 -0400
From: shangsong <shangsong2@...mail.com>
To: "Rafael J . Wysocki" <rafael@...nel.org>
Cc: Len Brown <lenb@...nel.org>,
linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Shang song <shangsong2@...ovo.com>
Subject: [PATCH 1/1] ACPI: PRM: Update address check for NULL handler
From: Shang song <shangsong2@...ovo.com>
According to section "4.1.2 PRM Handler Information Structure" in the
Platform Runtime Mechanism specification, the static data buffer and ACPI
parameter buffer may be NULL if not required. Therefore, when either
buffer is NULL, adding a check can prevent invalid virtual address
conversion attempts.
Without this patch, the following dmesg log could be misleading or
confusing to users:
kernel: Failed to find VA for GUID: 7626C6AE-F973-429C-A91C-107D7BE298B0, PA: 0x0
Signed-off-by: Shang song <shangsong2@...ovo.com>
---
drivers/acpi/prmt.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index e549914a636c..a97f0f3a6590 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -155,11 +155,21 @@ acpi_parse_prmt(union acpi_subtable_headers *header, const unsigned long end)
th->handler_addr =
(void *)efi_pa_va_lookup(&th->guid, handler_info->handler_address);
- th->static_data_buffer_addr =
- efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+ /*
+ * Per section "4.1.2 PRM Handler Information Structure" in
+ * spec "Platform Runtime Mechanism", the static data buffer
+ * and acpi parameter buffer may be NULL if they are not
+ * needed.
+ */
+ if (handler_info->static_data_buffer_address) {
+ th->static_data_buffer_addr =
+ efi_pa_va_lookup(&th->guid, handler_info->static_data_buffer_address);
+ }
- th->acpi_param_buffer_addr =
- efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
+ if (handler_info->acpi_param_buffer_address) {
+ th->acpi_param_buffer_addr =
+ efi_pa_va_lookup(&th->guid, handler_info->acpi_param_buffer_address);
+ }
} while (++cur_handler < tm->handler_count && (handler_info = get_next_handler(handler_info)));
--
2.43.5
Powered by blists - more mailing lists