[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0hsDVqZM=iP=4CYhGT99ScQ1xQNYHKcdJHHCscEhXOoCA@mail.gmail.com>
Date: Wed, 16 Feb 2022 13:22:27 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Tong Zhang <ztong0001@...il.com>
Cc: Robert Moore <robert.moore@...el.com>,
"Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
Len Brown <lenb@...nel.org>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
"open list:ACPI COMPONENT ARCHITECTURE (ACPICA)" <devel@...ica.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] ACPICA: proactively check null ptr to avoid API misuse
On Wed, Feb 16, 2022 at 7:26 AM Tong Zhang <ztong0001@...il.com> wrote:
>
> There are some cases that user use acpi_ns_walk_namespace() without
> checking acpi_disable flag. When acpi=off is provided in boot cmdline,
> acpi_gbl_root_node is NULL and calling acpi_ns_walk_namespace() will
> crash kernel. In order to avoid such misuse, we proactively check null ptr
> and return an error when we know ACPI is disabled.
The issue should be fixed by this commit in the upstream ACPICA code
base: https://github.com/acpica/acpica/commit/b1c3656ef4950098e530be68d4b589584f06cddc
>
> Signed-off-by: Tong Zhang <ztong0001@...il.com>
> ---
> drivers/acpi/acpica/nswalk.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/acpi/acpica/nswalk.c b/drivers/acpi/acpica/nswalk.c
> index 915c2433463d..9ae45db16d86 100644
> --- a/drivers/acpi/acpica/nswalk.c
> +++ b/drivers/acpi/acpica/nswalk.c
> @@ -171,6 +171,13 @@ acpi_ns_walk_namespace(acpi_object_type type,
> start_node = acpi_gbl_root_node;
> }
>
> + /* acpi_gbl_root_node is NULL when acpi=off is provided.
> + * We proactively check nulliness here and return an error if user call
> + * this function without checking acpi_disabled
> + */
> + if (start_node == NULL)
> + return_ACPI_STATUS(AE_ERROR);
> +
> /* Null child means "get first node" */
>
> parent_node = start_node;
> --
> 2.25.1
>
Powered by blists - more mailing lists