[PATCH] of: overlay: propagate error unflattening DTBO
Ahmad Fatoum
a.fatoum at pengutronix.de
Wed Feb 18 04:20:40 PST 2026
of_unflatten_dtb() may return an error pointer when parsing of the
device tree blob failed. Error pointers were not checked in
of_overlay_apply_dtbo() leading to a panic when they were later
dereferenced in of_copy_node().
Add an early exit to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
drivers/of/overlay.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 34543403e9ba..4345489b3b40 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -351,6 +351,9 @@ int of_overlay_apply_dtbo(struct device_node *root, const void *dtbo)
int ret;
overlay = of_unflatten_dtb(dtbo, INT_MAX);
+ if (IS_ERR(overlay))
+ return PTR_ERR(overlay);
+
ret = of_overlay_apply_tree(root, overlay);
of_delete_node(overlay);
--
2.47.3
More information about the barebox
mailing list