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: <20230922192724.295129-1-nfraprado@collabora.com>
Date:   Fri, 22 Sep 2023 15:27:18 -0400
From:   Nícolas F. R. A. Prado 
        <nfraprado@...labora.com>
To:     "Rafael J . Wysocki" <rafael@...nel.org>,
        Daniel Lezcano <daniel.lezcano@...aro.org>
Cc:     kernel@...labora.com,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>,
        Nícolas F. R. A. Prado 
        <nfraprado@...labora.com>, Amit Kucheria <amitk@...nel.org>,
        Zhang Rui <rui.zhang@...el.com>, linux-kernel@...r.kernel.org,
        linux-pm@...r.kernel.org
Subject: [PATCH] thermal: core: Check correct temperature for thermal trip notification

The thermal trip down notification should be triggered when the
temperature goes below the trip temperature minus the hysteresis. But
while the temperature is correctly checked against that, the last
temperature is instead compared against the trip point temperature. The
end result is that the notification won't always be triggered, only when
the temperature happens to drop quick enough so that the last
temperature was still above the trip point temperature.

Fix the incorrect check.

Fixes: 55cdf0a283b8 ("thermal: core: Add notifications call in the framework")
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@...labora.com>

---

 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 58533ea75cd9..120fcf23b8e5 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -361,7 +361,7 @@ static void handle_thermal_trip(struct thermal_zone_device *tz, int trip_id)
 		    tz->temperature >= trip.temperature)
 			thermal_notify_tz_trip_up(tz->id, trip_id,
 						  tz->temperature);
-		if (tz->last_temperature >= trip.temperature &&
+		if (tz->last_temperature >= (trip.temperature - trip.hysteresis) &&
 		    tz->temperature < (trip.temperature - trip.hysteresis))
 			thermal_notify_tz_trip_down(tz->id, trip_id,
 						    tz->temperature);
-- 
2.42.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ