Commit c81f6ce1 authored by Lizhi Hou's avatar Lizhi Hou Committed by Rob Herring (Arm)
Browse files

of: dynamic: Fix memleak when of_pci_add_properties() failed



When of_pci_add_properties() failed, of_changeset_destroy() is called to
free the changeset. And of_changeset_destroy() puts device tree node in
each entry but does not free property in the entry. This leads to memory
leak in the failure case.

In of_changeset_add_prop_helper(), add the property to the device tree node
deadprops list. Thus, the property will also be freed along with device
tree node.

Fixes: b544fc2b ("of: dynamic: Add interfaces for creating device node dynamically")
Reported-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
Closes: https://lore.kernel.org/all/aJms+YT8TnpzpCY8@lpieralisi/


Tested-by: default avatarLorenzo Pieralisi <lpieralisi@kernel.org>
Signed-off-by: default avatarLizhi Hou <lizhi.hou@amd.com>
Link: https://lore.kernel.org/r/20250818152221.3685724-1-lizhi.hou@amd.com


Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
parent 79aef1a3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment