Skip to contentSkip to conversation

xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue

PATCH New ethan.zhao 1 participant 1 message Dec 8, 2013

Subsystems (2)
lore
Share & tools
lore

ethan.zhao

author
#0 lore raw

PATCH 1/1 xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue

Should check return value of debugfs_create_dir(), the d_mmu_debug pointer before using it in function xen_p2m_debugfs().

---
 arch/x86/xen/p2m.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/x86/xen/p2m.c +6 -1
index a61c7d5..ac17f99 100644
@@ -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);
Signature · 1 line
1.8.3.4 (Apple Git-47)