public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue
@ 2013-12-08 11:49 ethan.zhao
  0 siblings, 0 replies; only message in thread
From: ethan.zhao @ 2013-12-08 11:49 UTC (permalink / raw)
  To: konrad.wilk, stefano.stabellini
  Cc: JBeulich, tefano.stabellini, linux-kernel, ethan.zhao

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)


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-12-08 11:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-08 11:49 [PATCH] xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue ethan.zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox