[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0h6-LsYoMnPjOWoWpo7DS0hYeT0B6cgYc5sUo+N6-V2pQ@mail.gmail.com>
Date: Tue, 8 Jul 2025 14:30:32 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: shangsong <shangsong2@...mail.com>
Cc: "Rafael J . Wysocki" <rafael@...nel.org>, Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org, Shang song <shangsong2@...ovo.com>
Subject: Re: [PATCH 1/1] ACPI: PRM: Update address check for NULL handler
On Tue, Jul 8, 2025 at 11:40 AM shangsong <shangsong2@...mail.com> wrote:
>
> 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)));
>
> --
This
https://lore.kernel.org/linux-acpi/20250704014104.82524-1-qiyuzhu2@amd.com/
has already been applied.
Thanks!
Powered by blists - more mailing lists