summaryrefslogtreecommitdiff
path: root/kernel/time/time.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2014-12-01 23:04:06 -0500
committerJohn Stultz <john.stultz@linaro.org>2015-05-22 09:12:22 -0700
commit6f7d79849a00bba82d3139ff91ff2aaabd12841e (patch)
treea211e8c8361e64c638f9bcc1131739a79585af7a /kernel/time/time.c
parent4e3d9cb0134fea035e6eb1707e5e7d8aaffa186d (diff)
time: Make sure tz_minuteswest is set to a valid value when setting time
Invalid values may overflow later, leading to undefined behaviour when multiplied by 60 to get the amount of seconds. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Signed-off-by: Sasha Levin <sasha.levin@oracle.com> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel/time/time.c')
-rw-r--r--kernel/time/time.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/kernel/time/time.c b/kernel/time/time.c
index c42c2c3214fe..972e3bbac963 100644
--- a/kernel/time/time.c
+++ b/kernel/time/time.c
@@ -173,6 +173,10 @@ int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
return error;
if (tz) {
+ /* Verify we're witin the +-15 hrs range */
+ if (tz->tz_minuteswest > 15*60 || tz->tz_minuteswest < -15*60)
+ return -EINVAL;
+
sys_tz = *tz;
update_vsyscall_tz();
if (firsttime) {