[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1464730335-21427-2-git-send-email-john.stultz@linaro.org>
Date: Tue, 31 May 2016 14:32:14 -0700
From: John Stultz <john.stultz@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: John Stultz <john.stultz@...aro.org>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Baolin Wang <baolin.wang@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Shuah Khan <shuahkh@....samsung.com>,
Arnd Bergmann <arnd@...db.de>, Ingo Molnar <mingo@...nel.org>,
Richard Cochran <richardcochran@...il.com>,
Prarit Bhargava <prarit@...hat.com>
Subject: [RFC][PATCH 1/2] time: Fix problematic change in settimeofday error checking
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@...ux.intel.com>
Cc: Baolin Wang <baolin.wang@...aro.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Shuah Khan <shuahkh@....samsung.com>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Richard Cochran <richardcochran@...il.com>
Cc: Prarit Bhargava <prarit@...hat.com>
Reported-by: Mika Westerberg <mika.westerberg@...ux.intel.com>
Signed-off-by: John Stultz <john.stultz@...aro.org>
---
include/linux/timekeeping.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h
index 37dbacf..4f01607 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 (tv && !timespec_valid(tv))
return -EINVAL;
ts64 = timespec_to_timespec64(*tv);
--
1.9.1
Powered by blists - more mailing lists