From: Phil Elwell <phil-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
To: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH] of/fdt: Fix EARLY_FLATTREE crash with no DTB
Date: Thu, 23 Oct 2014 12:10:19 +0100 [thread overview]
Message-ID: <5448E21B.4020502@raspberrypi.org> (raw)
of_flat_dt_debugfs_export_fdt uses initial_boot_params without checking
if it is valid, and ends up dereferencing a NULL pointer if there is
no DT blob.
This patch adds a check that initial_boot_params is NULL, returning
-ENOENT if it is.
Signed-off-by: Phil Elwell <phil-FnsA7b+Nu9XbIbC87yuRow@public.gmane.org>
---
drivers/of/fdt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index d1ffca8..f018e5b 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1085,8 +1085,12 @@ static struct debugfs_blob_wrapper flat_dt_blob;
static int __init of_flat_dt_debugfs_export_fdt(void)
{
- struct dentry *d = debugfs_create_dir("device-tree", NULL);
+ struct dentry *d;
+ if (!initial_boot_params)
+ return -ENOENT;
+
+ d = debugfs_create_dir("device-tree", NULL);
if (!d)
return -ENOENT;
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2014-10-23 11:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5448E21B.4020502@raspberrypi.org \
--to=phil-fnsa7b+nu9xbibc87yurow@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).