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 <[email protected]>
---
 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)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to