* [PATCH] of: overlay: propagate error unflattening DTBO
@ 2026-02-18 12:20 Ahmad Fatoum
2026-02-23 9:16 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread
* Re: [PATCH] of: overlay: propagate error unflattening DTBO
2026-02-18 12:20 [PATCH] of: overlay: propagate error unflattening DTBO Ahmad Fatoum
@ 2026-02-23 9:16 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2026-02-23 9:16 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Wed, 18 Feb 2026 13:20:40 +0100, Ahmad Fatoum wrote:
> 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.
>
> [...]
Applied, thanks!
[1/1] of: overlay: propagate error unflattening DTBO
https://git.pengutronix.de/cgit/barebox/commit/?id=5dacdb56e0cc (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-23 9:16 UTC | newest]
Thread overview: 2+ messages (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
2026-02-23 9:16 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox