Re: [PATCH] ACPI: property: Do not free embedded subnode packages
From: Rafael J. Wysocki (Intel)
Date: Fri Nov 13 2026 - 12:08:38 EST
On Thu, Nov 12, 2026 at 10:19 AM raoxu <raoxu@xxxxxxxxxxxxx> wrote:
>
> From: Xu Rao <raoxu@xxxxxxxxxxxxx>
>
> The _DSD data-subnode parser accepts both named-object paths and packages
> embedded in an enclosing evaluation result. For a named-object path,
> acpi_nondev_subnode_ok() evaluates the object into a separate buffer and
> passes its handle to acpi_nondev_subnode_extract(). For an embedded
> package, acpi_add_nondev_subnodes() passes an interior pointer into the
> enclosing result and a NULL handle instead.
>
> acpi_destroy_nondev_subnodes() unconditionally frees dn->data.pointer
> in both cases. Unloading an SSDT with embedded data subnodes therefore
> attempts to free an interior address, as reported by KASAN. Subnodes
> created exclusively from named-object paths do not have this problem.
>
> Only free a subnode's result buffer when dn->handle is non-NULL. Embedded
> packages are owned by the enclosing evaluation result, which is freed
> after its child nodes have been destroyed. Keep the property-container
> and data-node cleanup for both kinds of subnode.
>
> Fixes: 99db5ff7fe0b ("ACPI / property: Hierarchical properties support update")
> Reported-by: Shuangpeng Bai <shuangpeng.kernel@xxxxxxxxx>
> Link: https://lists.openwall.net/linux-kernel/2026/06/05/10
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>
> ---
> drivers/acpi/property.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> index 8ee5a1f0eb48..3a26df35979d 100644
> --- a/drivers/acpi/property.c
> +++ b/drivers/acpi/property.c
> @@ -664,7 +664,8 @@ static void acpi_destroy_nondev_subnodes(struct list_head *list)
> acpi_destroy_nondev_subnodes(&dn->data.subnodes);
> wait_for_completion(&dn->kobj_done);
> list_del(&dn->sibling);
> - ACPI_FREE((void *)dn->data.pointer);
> + if (dn->handle)
> + ACPI_FREE((void *)dn->data.pointer);
> acpi_free_device_properties(&dn->data.properties);
> kfree(dn);
> }
> --
Applied as 7.5 material, thanks!