Skip to content

Commit 46981fa

Browse files
Sakari Ailusrafaeljw
authored andcommitted
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: kernel test robot <oliver.sang@intel.com> Fixes: 1d52f10 ("ACPI: property: Tie data nodes to acpi handles") Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> [ rjw: Drop unrelated white space change ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 369af6b commit 46981fa

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/acpi/property.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -566,11 +566,12 @@ void acpi_init_properties(struct acpi_device *adev)
566566
&adev->data, acpi_fwnode_handle(adev)))
567567
adev->data.pointer = buf.pointer;
568568

569-
if (!adev->data.pointer ||
570-
!acpi_tie_nondev_subnodes(&adev->data)) {
571-
acpi_untie_nondev_subnodes(&adev->data);
569+
if (!adev->data.pointer) {
572570
acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n");
573571
ACPI_FREE(buf.pointer);
572+
} else {
573+
if (!acpi_tie_nondev_subnodes(&adev->data))
574+
acpi_untie_nondev_subnodes(&adev->data);
574575
}
575576

576577
out:

0 commit comments

Comments
 (0)