[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1386503356-1286-1-git-send-email-ethan.kernel@gmail.com>
Date: Sun, 8 Dec 2013 19:49:16 +0800
From: "ethan.zhao" <ethan.kernel@...il.com>
To: konrad.wilk@...cle.com, stefano.stabellini@...citrix.com
Cc: JBeulich@...e.com, tefano.stabellini@...rix.com,
linux-kernel@...r.kernel.org, "ethan.zhao" <ethan.kernel@...il.com>
Subject: [PATCH] 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().
Signed-off-by: ethan.zhao <ethan.kernel@...il.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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists