[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJZ5v0iCQa0jr28YeT3j3OXSVp_sZmjw=617itt1UeGSE3t90A@mail.gmail.com>
Date: Fri, 12 Sep 2025 21:14:58 +0200
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Zilin Guan <zilin@....edu.cn>
Cc: rafael@...nel.org, robert.moore@...el.com, lenb@...nel.org,
linux-acpi@...r.kernel.org, acpica-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org, jianhao.xu@....edu.cn
Subject: Re: [PATCH] acpi: replace ACPI_FREE with acpi_ut_delete_object_desc
On Fri, Sep 12, 2025 at 5:47 PM Zilin Guan <zilin@....edu.cn> wrote:
>
> acpi_ut_create_internal_object may allocate memory from a slab cache
> via kmem_cache_zalloc, but the code currently frees it with ACPI_FREE,
> which calls kfree. This mismatch prevents the object from being
> released properly and may lead to memory leaks or other issues.
>
> Fix this by replacing ACPI_FREE with acpi_ut_delete_object_desc, which
> matches the allocation method used for internal objects.
>
> Signed-off-by: Zilin Guan <zilin@....edu.cn>
Please submit ACPICA updates as pull requests to the upstream ACPICA
project on GitHub. Once merged there, corresponding Linux patches can
be submitted with Link: tags pointing to the original upstream ACPICA
commits.
Thanks!
> ---
> drivers/acpi/acpica/nsxfname.c | 2 +-
> drivers/acpi/acpica/utobject.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/acpi/acpica/nsxfname.c b/drivers/acpi/acpica/nsxfname.c
> index 1db831545ec8..b6895a48ae68 100644
> --- a/drivers/acpi/acpica/nsxfname.c
> +++ b/drivers/acpi/acpica/nsxfname.c
> @@ -601,7 +601,7 @@ acpi_status acpi_install_method(u8 *buffer)
> error_exit:
>
> ACPI_FREE(aml_buffer);
> - ACPI_FREE(method_obj);
> + acpi_ut_delete_object_desc(method_obj);
> return (status);
> }
> ACPI_EXPORT_SYMBOL(acpi_install_method)
> diff --git a/drivers/acpi/acpica/utobject.c b/drivers/acpi/acpica/utobject.c
> index 272e46208263..8362204b57b5 100644
> --- a/drivers/acpi/acpica/utobject.c
> +++ b/drivers/acpi/acpica/utobject.c
> @@ -148,7 +148,7 @@ union acpi_operand_object *acpi_ut_create_package_object(u32 count)
> package_elements = ACPI_ALLOCATE_ZEROED(((acpi_size)count +
> 1) * sizeof(void *));
> if (!package_elements) {
> - ACPI_FREE(package_desc);
> + acpi_ut_delete_object_desc(package_desc);
> return_PTR(NULL);
> }
>
> --
> 2.34.1
>
>
Powered by blists - more mailing lists