diff options
| author | Tom Verdonck <tom.verdonck@inspiral.be> | 2026-09-25 20:23:23 +0200 |
|---|---|---|
| committer | Guenter Roeck <linux@roeck-us.net> | 2026-09-25 20:26:30 -0700 |
| commit | 6b8b1d1d7bc7e579b53fc7c3293b787d68de702a (patch) | |
| tree | f6c67b0382e6ee8ef2e8857ef67a32c6582dc0ea /tools/lib/python/kdoc/python_version.py | |
| parent | 56c1d32323e773b8b927316f8beeae9238576335 (diff) | |
| download | linux-next-6b8b1d1d7bc7e579b53fc7c3293b787d68de702a.tar.gz linux-next-6b8b1d1d7bc7e579b53fc7c3293b787d68de702a.zip | |
hwmon: (tmp108) Fix jiffies wraparound in conversion-ready check
tmp108 records a one-shot deadline in ->ready_time at probe (and resume)
and, on every temperature read, refuses the read with -EAGAIN while
time_before(jiffies, ready_time) is true, in order to skip the initial
conversion.
->ready_time 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 ->ready_time is set once and
never refreshed, 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() then permanently reports
"not ready" and the driver returns -EAGAIN on every read, without ever
touching the sensor, until the next reboot. The continuous-mode path,
which sets ->ready_time to jiffies with no added conversion delay, wraps
the same way.
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: 66e1c9171339 ("hwmon: Add Texas Instruments TMP108 temperature sensor driver.")
Cc: stable@vger.kernel.org
Signed-off-by: Tom Verdonck <tom.verdonck@inspiral.be>
Link: https://patch.msgid.link/525fa49d8c50922344fa53e22be5e6133c9bbb62.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
