lkml.org 
[lkml]   [2013]   [Dec]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] xen/p2m: Check d_mmu_debug dentry to void NULL pointer issue
Date
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)


\
 
 \ /
  Last update: 2013-12-08 13:21    [W:0.022 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site