lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1465318345-22043-5-git-send-email-bp@alien8.de>
Date:	Tue,  7 Jun 2016 18:52:25 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	linux-edac <linux-edac@...r.kernel.org>
Cc:	Tony Luck <tony.luck@...el.com>,
	Yazen Ghannam <Yazen.Ghannam@....com>, X86 ML <x86@...nel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 4/4] x86/mce-inject: Use debugfs_remove_recursive()

From: Borislav Petkov <bp@...e.de>

... and simplify a bit.

No functionality change.

Signed-off-by: Borislav Petkov <bp@...e.de>
---
 arch/x86/kernel/cpu/mcheck/mce-inject.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index f1d8d3f9ec1d..675d2da3d31f 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -676,8 +676,8 @@ static struct dfs_node {
 
 static int __init debugfs_init(void)
 {
-	int i;
 	u64 cap;
+	int i;
 
 	rdmsrl(MSR_IA32_MCG_CAP, cap);
 	n_banks = cap & MCG_BANKCNT_MASK;
@@ -700,28 +700,12 @@ static int __init debugfs_init(void)
 	return 0;
 
 err_dfs_add:
-	while (--i >= 0)
-		debugfs_remove(dfs_fls[i].d);
-
-	debugfs_remove(dfs_inj);
+	debugfs_remove_recursive(dfs_inj);
 	dfs_inj = NULL;
 
 	return -ENOMEM;
 }
 
-static void __exit debugfs_exit(void)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(dfs_fls); i++)
-		debugfs_remove(dfs_fls[i].d);
-
-	memset(&dfs_fls, 0, sizeof(dfs_fls));
-
-	debugfs_remove(dfs_inj);
-	dfs_inj = NULL;
-}
-
 static int inject_init(void)
 {
 	int err;
@@ -752,6 +736,16 @@ module_init(inject_init);
  * guarantee all openers of mce_chrdev will get a reference to us.
  */
 #ifndef CONFIG_X86_MCELOG
+static void __exit debugfs_exit(void)
+{
+	debugfs_remove_recursive(dfs_inj);
+	dfs_inj = NULL;
+
+	unregister_nmi_handler(NMI_LOCAL, "mce_notify");
+
+	free_cpumask_var(mce_inject_cpumask);
+}
+
 module_exit(debugfs_exit);
 #endif
 
-- 
2.7.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ