diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2022-08-09 00:12:13 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-08-09 19:14:11 +0200 |
commit | 46981fa78490e16589559cec8c762e5527d665d2 (patch) | |
tree | 46f5b5bec7f946ca3f48848e7b10b2ca05eb823b /drivers/acpi/property.c | |
parent | 369af6bf2c28f9f57438e82f953f6351cf2a94cd (diff) | |
download | linux-46981fa78490e16589559cec8c762e5527d665d2.tar.bz2 |
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: 1d52f10917a7 ("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>
Diffstat (limited to 'drivers/acpi/property.c')
-rw-r--r-- | drivers/acpi/property.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c index d26f630f2a7c..f649ae9645c9 100644 --- a/drivers/acpi/property.c +++ b/drivers/acpi/property.c @@ -566,11 +566,12 @@ void acpi_init_properties(struct acpi_device *adev) &adev->data, acpi_fwnode_handle(adev))) adev->data.pointer = buf.pointer; - if (!adev->data.pointer || - !acpi_tie_nondev_subnodes(&adev->data)) { - acpi_untie_nondev_subnodes(&adev->data); + if (!adev->data.pointer) { acpi_handle_debug(adev->handle, "Invalid _DSD data, skipping\n"); ACPI_FREE(buf.pointer); + } else { + if (!acpi_tie_nondev_subnodes(&adev->data)) + acpi_untie_nondev_subnodes(&adev->data); } out: |