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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Fri, 20 Sep 2013 10:44:03 -0700
From:	Yinghai Lu <yinghai@...nel.org>
To:	"Rafael J. Wysocki" <rjw@...k.pl>,
	Viresh Kumar <viresh.kumar@...aro.org>
Cc:	cpufreq@...r.kernel.org, linux-acpi@...r.kernel.org,
	linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
	Yinghai Lu <yinghai@...nel.org>
Subject: [PATCH -v2] cpufreq: fix racing between acpi_cpufreq_loading

There is racing in
	__acpi_processor_start
		 ==> acpi_processor_load_module
			 ==> request_module_nowait/requested = 1
before first pr path to have requested set, second cpu would request again.
that will cause acpi_cpufreq_early_init to be called in parallel,
that will cause data curruption in acpi_cpufreq_early_init...
and intermittent crash.

So add mutex to protect it.

Signed-off-by: Yinghai Lu <yinghai@...nel.org>

---
 drivers/acpi/processor_perflib.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/acpi/processor_perflib.c
===================================================================
--- linux-2.6.orig/drivers/acpi/processor_perflib.c
+++ linux-2.6/drivers/acpi/processor_perflib.c
@@ -235,6 +235,7 @@ void acpi_processor_ppc_exit(void)
 	acpi_processor_ppc_status &= ~PPC_REGISTERED;
 }
 
+static DEFINE_MUTEX(acpi_cpufreq_load_lock);
 /*
  * Do a quick check if the systems looks like it should use ACPI
  * cpufreq. We look at a _PCT method being available, but don't
@@ -246,8 +247,12 @@ void acpi_processor_load_module(struct a
 	acpi_status status = 0;
 	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
 
-	if (!arch_has_acpi_pdc() || requested)
+	mutex_lock(&acpi_cpufreq_load_lock);
+	if (!arch_has_acpi_pdc() || requested) {
+		mutex_unlock(&acpi_cpufreq_load_lock);
 		return;
+	}
+
 	status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer);
 	if (!ACPI_FAILURE(status)) {
 		printk(KERN_INFO PREFIX "Requesting acpi_cpufreq\n");
@@ -255,6 +260,7 @@ void acpi_processor_load_module(struct a
 		requested = 1;
 	}
 	kfree(buffer.pointer);
+	mutex_unlock(&acpi_cpufreq_load_lock);
 }
 
 static int acpi_processor_get_performance_control(struct acpi_processor *pr)
--
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