* [PATCH] of: overlay: propagate error unflattening DTBO
@ 2026-02-18 12:20 Ahmad Fatoum
0 siblings, 0 replies; only message in thread
From: Ahmad Fatoum @ 2026-02-18 12:20 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
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@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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-02-18 12:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-18 12:20 [PATCH] of: overlay: propagate error unflattening DTBO Ahmad Fatoum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox