aboutsummaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorJan Engelmohr <jan.engelmohr@mailbox.tu-dresden.de>2016-07-26 15:25:59 +0200
committerMoyster <oysterized@gmail.com>2016-08-26 15:52:24 +0200
commit516480c70a5392533c2e3a81863ac02206a66e1b (patch)
treec22efa9678c72859bd4f47c40d40e57139fa8131 /kernel
parent08b83025dbff0cf59c6de550262999b3959067b2 (diff)
3.10.66 -> 3.10.67
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time.c4
-rw-r--r--kernel/time/ntp.c7
2 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time.c b/kernel/time.c
index b0f7b1d49..5d4d9a024 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -198,6 +198,10 @@ SYSCALL_DEFINE2(settimeofday, struct timeval __user *, tv,
if (tv) {
if (copy_from_user(&user_tv, tv, sizeof(*tv)))
return -EFAULT;
+
+ if (!timeval_valid(&user_tv))
+ return -EINVAL;
+
new_ts.tv_sec = user_tv.tv_sec;
new_ts.tv_nsec = user_tv.tv_usec * NSEC_PER_USEC;
}
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index af8d1d4f3..28db9bedc 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -631,6 +631,13 @@ int ntp_validate_timex(struct timex *txc)
if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME)))
return -EPERM;
+ if (txc->modes & ADJ_FREQUENCY) {
+ if (LONG_MIN / PPM_SCALE > txc->freq)
+ return -EINVAL;
+ if (LONG_MAX / PPM_SCALE < txc->freq)
+ return -EINVAL;
+ }
+
return 0;
}