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-next>] [day] [month] [year] [list]
Date:   Fri,  4 Jun 2021 12:05:00 -0500
From:   kyle.meyer@....com
To:     rjw@...ysocki.net, viresh.kumar@...aro.org,
        linux-kernel@...r.kernel.org
Cc:     linux-pm@...r.kernel.org, linux-acpi@...r.kernel.org,
        Kyle Meyer <kyle.meyer@....com>, Takashi Iwai <tiwai@...e.com>
Subject: [PATCH] acpi-cpufreq: Skip cleanup if initialization didn't occur

From: Kyle Meyer <kyle.meyer@....com>

acpi-cpufreq is loaded without performing initialization when a cpufreq
driver exists.

If initialization didn't occur then skip cleanup in acpi_cpufreq_exit().
This prevents unnecessary freeing and unregistering when the module is
unloaded.

Reported-by: Takashi Iwai <tiwai@...e.com>
Signed-off-by: Kyle Meyer <kyle.meyer@....com>
---
 drivers/cpufreq/acpi-cpufreq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c
index 7e7450453714..8d425f14c267 100644
--- a/drivers/cpufreq/acpi-cpufreq.c
+++ b/drivers/cpufreq/acpi-cpufreq.c
@@ -1042,8 +1042,19 @@ static int __init acpi_cpufreq_init(void)
 
 static void __exit acpi_cpufreq_exit(void)
 {
+	const char *current_driver;
+
 	pr_debug("%s\n", __func__);
 
+	/*
+	 * If another cpufreq_driver was loaded, preventing acpi-cpufreq from
+	 * registering, there's no need to unregister it.
+	 */
+	current_driver = cpufreq_get_current_driver();
+	if (!current_driver ||
+	    strncmp(current_driver, acpi_cpufreq_driver.name, strlen(acpi_cpufreq_driver.name)))
+		return;
+
 	acpi_cpufreq_boost_exit();
 
 	cpufreq_unregister_driver(&acpi_cpufreq_driver);
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ