summaryrefslogtreecommitdiff
path: root/include/linux/of.h
diff options
context:
space:
mode:
authorFrank Rowand <frank.rowand@sony.com>2022-04-20 17:25:05 -0500
committerRob Herring <robh@kernel.org>2022-04-25 10:56:11 -0500
commit067c098766c6af667a9002d4e33cf1f3c998abbe (patch)
treed86a99533cbc90d9542846d54fc73cf0f7d09e14 /include/linux/of.h
parent1e4089667c7c732dd1b92c4c6bc7bd240ca30213 (diff)
of: overlay: rework overlay apply and remove kfree()s
Fix various kfree() issues related to of_overlay_apply(). - Double kfree() of fdt and tree when init_overlay_changeset() returns an error. - free_overlay_changeset() free the root of the unflattened overlay (variable tree) instead of the memory that contains the unflattened overlay. - For the case of a failure during applying an overlay, move kfree() of new_fdt and overlay_mem into free_overlay_changeset(), which is called by the function that allocated them. - For the case of removing an overlay, the kfree() of new_fdt and overlay_mem remains in free_overlay_changeset(). - Check return value of of_fdt_unflatten_tree() for error instead of checking the returned value of overlay_root. - When storing pointers to allocated objects in ovcs, do so as near to the allocation as possible instead of in deeply layered function. More clearly document policy related to lifetime of pointers into overlay memory. Double kfree() Reported-by: Slawomir Stepien <slawomir.stepien@nokia.com> Signed-off-by: Frank Rowand <frank.rowand@sony.com> Signed-off-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20220420222505.928492-3-frowand.list@gmail.com
Diffstat (limited to 'include/linux/of.h')
-rw-r--r--include/linux/of.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/of.h b/include/linux/of.h
index 04971e85fbc9..17741eee0ca4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -1543,7 +1543,8 @@ static inline bool of_device_is_system_power_controller(const struct device_node
*/
enum of_overlay_notify_action {
- OF_OVERLAY_PRE_APPLY = 0,
+ OF_OVERLAY_INIT = 0, /* kzalloc() of ovcs sets this value */
+ OF_OVERLAY_PRE_APPLY,
OF_OVERLAY_POST_APPLY,
OF_OVERLAY_PRE_REMOVE,
OF_OVERLAY_POST_REMOVE,