Messages in this thread Patch in this message | | | From | John Stultz <> | Subject | [PATCH 1/2 v2] time: Fix problematic change in settimeofday error checking | Date | Wed, 1 Jun 2016 11:53:26 -0700 |
| |
In commit 86d3473224b0 ("time: Introduce do_sys_settimeofday64()") 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.
Cc: Mika Westerberg <mika.westerberg@linux.intel.com> Cc: Baolin Wang <baolin.wang@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Shuah Khan <shuahkh@osg.samsung.com> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Prarit Bhargava <prarit@redhat.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reported-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: John Stultz <john.stultz@linaro.org> --- v2: Add logic simplification from Dima Stepanov <dstepanov.src@gmail.com>
include/linux/timekeeping.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 37dbacf..816b754 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h @@ -21,6 +21,9 @@ static inline int do_sys_settimeofday(const struct timespec *tv, struct timespec64 ts64; if (!tv) + return do_sys_settimeofday64(NULL, tz); + + if (!timespec_valid(tv)) return -EINVAL; ts64 = timespec_to_timespec64(*tv); -- 1.9.1
| |