Re: [PATCH 1/3] hwmon: (tmp102) Fix jiffies wraparound in conversion-ready check
From: Guenter Roeck
Date: Fri Sep 25 2026 - 23:26:13 EST
On Fri, Sep 25, 2026 at 08:23:22PM +0200, Tom Verdonck wrote:
> tmp102 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 first
> ~35 ms 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.
>
> 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: 3d8f7a89a197 ("hwmon: (tmp102) Improve handling of initial read delay")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Tom Verdonck <tom.verdonck@xxxxxxxxxxx>
Applied.
Thanks,
Guenter