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: <1433950426-10084-2-git-send-email-bp@alien8.de>
Date:	Wed, 10 Jun 2015 17:33:45 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Aravind Gopalakrishnan <Aravind.Gopalakrishnan@....com>
Cc:	linux-edac <linux-edac@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] EDAC, mce_amd_inj: Move bit preparations before the injection

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

We do get_online_cpus() and then start noodling with the bits. Do that
*before* we grab the hotplug lock. This accidentally fixes the other
issue where we check if a CPU is online but then go ahead and find out
the NBC core which might not be the same CPU as the CPU we want to
inject on.

Signed-off-by: Borislav Petkov <bp@...e.de>
---
 drivers/edac/mce_amd_inj.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/mce_amd_inj.c b/drivers/edac/mce_amd_inj.c
index 30227f30e7c6..5001d166f54f 100644
--- a/drivers/edac/mce_amd_inj.c
+++ b/drivers/edac/mce_amd_inj.c
@@ -266,10 +266,6 @@ static void do_inject(void)
 		i_mce.status &= ~MCI_STATUS_UC;
 	}
 
-	get_online_cpus();
-	if (!cpu_online(cpu))
-		goto err;
-
 	/* prep MCE global settings for the injection */
 	mcg_status = MCG_STATUS_MCIP | MCG_STATUS_EIPV;
 
@@ -290,6 +286,10 @@ static void do_inject(void)
 		cpu = get_nbc_for_node(amd_get_nb_id(cpu));
 	}
 
+	get_online_cpus();
+	if (!cpu_online(cpu))
+		goto err;
+
 	toggle_hw_mce_inject(cpu, true);
 
 	wrmsr_on_cpu(cpu, MSR_IA32_MCG_STATUS,
-- 
2.3.5

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ