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>] [day] [month] [year] [list]
Date:	Wed, 30 Nov 2011 15:49:55 +0100
From:	Borislav Petkov <bp@...64.org>
To:	Dave Jones <davej@...hat.com>
Cc:	cpufreq@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
	Borislav Petkov <borislav.petkov@....com>
Subject: [PATCH 2/2] powernow-k8: Fix unregister order

From: Borislav Petkov <borislav.petkov@....com>

When we're CPB capable and have allocated a percpu msrs variable, we
need to first unregister the notifier and then free the msrs because the
notifier touches the said variable which could disappear in-between.

Signed-off-by: Borislav Petkov <borislav.petkov@....com>
---
 drivers/cpufreq/powernow-k8.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 1c6d879..c36983e 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -1582,7 +1582,7 @@ static int __cpuinit powernowk8_init(void)
 	}
 
 	rv = cpufreq_register_driver(&cpufreq_amd64_driver);
-	if (rv < 0 && boot_cpu_has(X86_FEATURE_CPB)) {
+	if (rv < 0 && cpb_capable) {
 		unregister_cpu_notifier(&cpb_nb);
 		msrs_free(msrs);
 		msrs = NULL;
@@ -1595,11 +1595,10 @@ static void __exit powernowk8_exit(void)
 {
 	pr_debug("exit\n");
 
-	if (boot_cpu_has(X86_FEATURE_CPB)) {
+	if (cpb_capable) {
+		unregister_cpu_notifier(&cpb_nb);
 		msrs_free(msrs);
 		msrs = NULL;
-
-		unregister_cpu_notifier(&cpb_nb);
 	}
 
 	cpufreq_unregister_driver(&cpufreq_amd64_driver);
-- 
1.7.8.rc0

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