Skip to content

Commit 3bd561e

Browse files
Sakari Ailusrafaeljw
authored andcommitted
ACPI: property: Release subnode properties with data nodes
struct acpi_device_properties describes one source of properties present on either struct acpi_device or struct acpi_data_node. When properties are parsed, both are populated but when released, only those properties that are associated with the device node are freed. Fix this by also releasing memory of the data node properties. Fixes: 5f5e489 ("ACPI / property: Allow multiple property compatible _DSD entries") Cc: 4.20+ <[email protected]> # 4.20+ Signed-off-by: Sakari Ailus <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 99c6370 commit 3bd561e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

drivers/acpi/property.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,16 @@ void acpi_init_properties(struct acpi_device *adev)
433433
acpi_extract_apple_properties(adev);
434434
}
435435

436+
static void acpi_free_device_properties(struct list_head *list)
437+
{
438+
struct acpi_device_properties *props, *tmp;
439+
440+
list_for_each_entry_safe(props, tmp, list, list) {
441+
list_del(&props->list);
442+
kfree(props);
443+
}
444+
}
445+
436446
static void acpi_destroy_nondev_subnodes(struct list_head *list)
437447
{
438448
struct acpi_data_node *dn, *next;
@@ -445,22 +455,18 @@ static void acpi_destroy_nondev_subnodes(struct list_head *list)
445455
wait_for_completion(&dn->kobj_done);
446456
list_del(&dn->sibling);
447457
ACPI_FREE((void *)dn->data.pointer);
458+
acpi_free_device_properties(&dn->data.properties);
448459
kfree(dn);
449460
}
450461
}
451462

452463
void acpi_free_properties(struct acpi_device *adev)
453464
{
454-
struct acpi_device_properties *props, *tmp;
455-
456465
acpi_destroy_nondev_subnodes(&adev->data.subnodes);
457466
ACPI_FREE((void *)adev->data.pointer);
458467
adev->data.of_compatible = NULL;
459468
adev->data.pointer = NULL;
460-
list_for_each_entry_safe(props, tmp, &adev->data.properties, list) {
461-
list_del(&props->list);
462-
kfree(props);
463-
}
469+
acpi_free_device_properties(&adev->data.properties);
464470
}
465471

466472
/**

0 commit comments

Comments
 (0)