diff options
| author | Tom Verdonck <tom.verdonck@inspiral.be> | 2026-09-25 20:23:24 +0200 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-09-25 20:27:04 -0700 |
| commit | 61406e9cac695b19b979b002d790d346b9f07887 (patch) | |
| tree | 533c47441db528bda594f89330b0fd725e1edaf1 /tools/lib/python/kdoc/python_version.py | |
| parent | 6b8b1d1d7bc7e579b53fc7c3293b787d68de702a (diff) | |
| download | linux-next-61406e9cac695b19b979b002d790d346b9f07887.tar.gz linux-next-61406e9cac695b19b979b002d790d346b9f07887.zip | |
hwmon: (sht4x) Fix jiffies wraparound in heater-ready check
sht4x stores in ->heating_complete the jiffies deadline at which the
current heater pulse finishes. It is set once at probe (to jiffies) and
only updated when the heater is explicitly enabled via sysfs, so in the
common case where the heater is never used it stays frozen at its probe
value.
->heating_complete is an unsigned long compared with time_before(),
whose signed difference is only meaningful while the two values are
within LONG_MAX jiffies of each other. Because the deadline is frozen,
jiffies keeps advancing away from it, and after 2^31 jiffies the
difference flips sign. On a 32-bit HZ=100 kernel that happens ~248.5
days after boot. time_before() in sht4x_read_values() then wrongly
reports that heating is still in progress and the read path executes
msleep(jiffies_to_msecs(data->heating_complete - curr_jiffies));
with a bogus, huge delta, blocking the temperature read for a very long
time instead of returning data. The heater_enable sysfs attributes are
affected the same way (spurious -EBUSY and "1" readback).
Store the deadline as a 64-bit jiffies value and compare it with
get_jiffies_64()/time_before64(), which does not wrap in any practical
uptime.
Fixes: 0eed6fc3d2b9 ("hwmon: (sht4x): add heater support")
Cc: stable@vger.kernel.org
Signed-off-by: Tom Verdonck <tom.verdonck@inspiral.be>
Link: https://patch.msgid.link/7b2087ccb963e097cf3f6333efaec0c46549003b.1790358356.git.tom.verdonck@inspiral.be
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
