diff options
| author | Wang Yan <wangyan01@kylinos.cn> | 2026-06-22 13:33:48 +0300 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-06-22 14:20:20 +0300 |
| commit | 269f2b43fae692d1f3988c9f888a6301aa537b82 (patch) | |
| tree | 5acc91ef13e2317d3de053aee2a3f85445fff6d4 /scripts/Makefile.thinlto | |
| parent | f8aceb1adb05896d66a3abbc1b0f41b90c9179ae (diff) | |
| download | linux-269f2b43fae692d1f3988c9f888a6301aa537b82.tar.xz | |
time: Fix off-by-one in compat settimeofday() usec validation
The compat version of settimeofday() uses '>' instead of '>=' when
validating tv_usec against USEC_PER_SEC, allowing the value 1000000 to pass
the check. After the subsequent conversion to nanoseconds (tv_nsec *=
NSEC_PER_USEC), this results in tv_nsec == NSEC_PER_SEC, which violates the
timespec invariant that tv_nsec must be strictly less than NSEC_PER_SEC.
The native settimeofday() was already fixed in commit ce4abda5e126 ("time:
Fix off-by-one in settimeofday() usec validation"), but the compat
counterpart was missed.
Fix it by using '>=' to reject tv_usec values outside the valid range [0,
USEC_PER_SEC - 1].
Fixes: 5e0fb1b57bea ("y2038: time: avoid timespec usage in settimeofday()")
Signed-off-by: Wang Yan <wangyan01@kylinos.cn>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260622103348.120255-1-wangyan01@kylinos.cn
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
