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>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 31 Mar 2024 18:37:06 +1000
From: Stephen Horvath <s.horvath@...look.com.au>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
	Zhang Rui <rui.zhang@...el.com>,
	Len Brown <lenb@...nel.org>,
	linux-acpi@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: Stephen Horvath <s.horvath@...look.com.au>
Subject: [PATCH v2] ACPI: thermal: Continue registering thermal zones even if trip points fail validation

Some laptops where the thermal control is handled by the EC may
provide trip points that fail the kernels new validation, but still have
working temperature sensors. An example of this is the Framework 13 AMD.

This patch allows the thermal zone to still be registered without trip
points if the trip points fail validation, allowing the temperature
sensor to be viewed and used by the user.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218586
Fixes: 9c8647224e9f ("ACPI: thermal: Use library functions to obtain trip point temperature values")
Signed-off-by: Stephen Horvath <s.horvath@...look.com.au>
---
 V1 -> V2: Referenced bug tracker in commit, and switched to using
                `thermal_tripless_zone_device_register` as per the
                suggestion of Rafael J. Wysocki.

 drivers/acpi/thermal.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 302dce0b2b50..10044c56b85e 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -662,14 +662,16 @@ static int acpi_thermal_register_thermal_zone(struct acpi_thermal *tz,
 {
 	int result;
 
-	tz->thermal_zone = thermal_zone_device_register_with_trips("acpitz",
-								   trip_table,
-								   trip_count,
-								   tz,
-								   &acpi_thermal_zone_ops,
-								   NULL,
-								   passive_delay,
-								   tz->polling_frequency * 100);
+	if (trip_count) {
+		tz->thermal_zone = thermal_zone_device_register_with_trips(
+			"acpitz", trip_table, trip_count, tz,
+			&acpi_thermal_zone_ops, NULL, passive_delay,
+			tz->polling_frequency * 100);
+	} else {
+		tz->thermal_zone = thermal_tripless_zone_device_register(
+			"acpitz", tz, &acpi_thermal_zone_ops, NULL);
+	}
+
 	if (IS_ERR(tz->thermal_zone))
 		return PTR_ERR(tz->thermal_zone);
 
@@ -903,8 +905,6 @@ static int acpi_thermal_add(struct acpi_device *device)
 
 	if (trip == trip_table) {
 		pr_warn(FW_BUG "No valid trip points!\n");
-		result = -ENODEV;
-		goto free_memory;
 	}
 
 	result = acpi_thermal_register_thermal_zone(tz, trip_table,

base-commit: 4cece764965020c22cff7665b18a012006359095
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ