Skip to content

Commit dfc2507

Browse files
johnstultz-workKAGA-KOKO
authored andcommitted
time: Make settimeofday error checking work again
In commit 86d3473 some of the checking for a valid timeval was subtley changed which caused -EINVAL to be returned whenever the timeval was null. However, it is possible to set the timezone data while specifying a NULL timeval, which is usually done to handle systems where the RTC keeps local time instead of UTC. Thus the patch causes such systems to have the time incorrectly set. This patch addresses the issue by handling the error conditionals in the same way as was done previously. Fixes: 86d3473 "time: Introduce do_sys_settimeofday64()" Reported-by: Mika Westerberg <[email protected]> Signed-off-by: John Stultz <[email protected]> Tested-by: Mika Westerberg <[email protected]> Cc: Prarit Bhargava <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Baolin Wang <[email protected]> Cc: Richard Cochran <[email protected]> Cc: Shuah Khan <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Gleixner <[email protected]>
1 parent 1a695a9 commit dfc2507

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

include/linux/timekeeping.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ static inline int do_sys_settimeofday(const struct timespec *tv,
2121
struct timespec64 ts64;
2222

2323
if (!tv)
24+
return do_sys_settimeofday64(NULL, tz);
25+
26+
if (!timespec_valid(tv))
2427
return -EINVAL;
2528

2629
ts64 = timespec_to_timespec64(*tv);

0 commit comments

Comments
 (0)