Commit 46981fa7 authored by Sakari Ailus's avatar Sakari Ailus Committed by Rafael J. Wysocki

ACPI: property: Fix error handling in acpi_init_properties()

buf.pointer, memory for storing _DSD data and nodes, was released if either
parsing properties or, as recently added, attaching data node tags failed.
Alas, properties were still left pointing to this memory if parsing
properties were successful but attaching data node tags failed.

Fix this by separating error handling for the two, and leaving properties
intact if data nodes cannot be tagged for a reason or another.
Reported-by: default avatarkernel test robot <oliver.sang@intel.com>
Fixes: 1d52f109 ("ACPI: property: Tie data nodes to acpi handles")
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
[ rjw: Drop unrelated white space change ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 369af6bf
...@@ -566,11 +566,12 @@ void acpi_init_properties(struct acpi_device *adev) ...@@ -566,11 +566,12 @@ void acpi_init_properties(struct acpi_device *adev)
&adev->data, acpi_fwnode_handle(adev))) &adev->data, acpi_fwnode_handle(adev)))
adev->data.pointer = buf.pointer; adev->data.pointer = buf.pointer;
if (!adev->data.pointer || if (!adev->data.pointer) {
!acpi_tie_nondev_subnodes(&adev->data)) {
acpi_untie_nondev_subnodes(&adev->data);
acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n"); acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n");
ACPI_FREE(buf.pointer); ACPI_FREE(buf.pointer);
} else {
if (!acpi_tie_nondev_subnodes(&adev->data))
acpi_untie_nondev_subnodes(&adev->data);
} }
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment