From: "ethan.zhao" <ethan.kernel@gmail.com>
To: konrad.wilk@oracle.com, stefano.stabellini@eu.citrix.com
Cc: JBeulich@suse.com, tefano.stabellini@citrix.com,
linux-kernel@vger.kernel.org,
"ethan.zhao" <ethan.kernel@gmail.com>
Subject: [PATCH] xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue
Date: Sun, 8 Dec 2013 19:49:16 +0800 [thread overview]
Message-ID: <1386503356-1286-1-git-send-email-ethan.kernel@gmail.com> (raw)
Should check return value of debugfs_create_dir(), the d_mmu_debug
pointer before using it in function xen_p2m_debugfs().
Signed-off-by: ethan.zhao <ethan.kernel@gmail.com>
---
arch/x86/xen/p2m.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index a61c7d5..ac17f99 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -1172,8 +1172,13 @@ static int __init xen_p2m_debugfs(void)
return -ENOMEM;
d_mmu_debug = debugfs_create_dir("mmu", d_xen);
+ if (!d_mmu_debug)
+ return -ENOENT;
+
+ if (!debugfs_create_file("p2m",
+ 0600, d_mmu_debug, NULL, &p2m_dump_fops))
+ return -ENOENT;
- debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops);
return 0;
}
fs_initcall(xen_p2m_debugfs);
--
1.8.3.4 (Apple Git-47)
reply other threads:[~2013-12-08 11:50 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=1386503356-1286-1-git-send-email-ethan.kernel@gmail.com \
--to=ethan.kernel@gmail.com \
--cc=JBeulich@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=tefano.stabellini@citrix.com \
/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