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]
Message-ID: <5802156.DvuYhMxLoT@rjwysocki.net>
Date: Thu, 11 Jul 2024 14:39:02 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux PM <linux-pm@...r.kernel.org>,
 Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Lukasz Luba <lukasz.luba@....com>
Subject:
 [PATCH v3] thermal: core: Add sanity checks for polling_delay and
 passive_delay

From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>

If polling_delay is nonzero and passive_delay is greater than
polling_delay, the thermal zone temperature will be updated less
often when tz->passive is nonzero, which is not as expected.  Make
the thermal zone registration fail with -EINVAL in that case as
this is a clear thermal zone configuration mistake.

If polling_delay is nonzero and passive_delay is 0, which is regarded
as a valid thermal zone configuration, the thermal zone will use polling
except when tz->passive is nonzero.  However, the expected behavior in
that case is to continue temperature polling with the same delay value
regardless of tz->passive, so set passive_delay to the polling_delay
value then.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
---

This supersedes

https://lore.kernel.org/linux-pm/4940808.31r3eYUQgx@rjwysocki.net/

---
 drivers/thermal/thermal_core.c |    8 ++++++++
 1 file changed, 8 insertions(+)

Index: linux-pm/drivers/thermal/thermal_core.c
===================================================================
--- linux-pm.orig/drivers/thermal/thermal_core.c
+++ linux-pm/drivers/thermal/thermal_core.c
@@ -1391,6 +1391,14 @@ thermal_zone_device_register_with_trips(
 	if (num_trips > 0 && !trips)
 		return ERR_PTR(-EINVAL);
 
+	if (polling_delay) {
+		if (passive_delay > polling_delay)
+			return ERR_PTR(-EINVAL);
+
+		if (!passive_delay)
+			passive_delay = polling_delay;
+	}
+
 	if (!thermal_class)
 		return ERR_PTR(-ENODEV);
 




Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ