diff options
| author | Linus Walleij <linus.walleij@linaro.org> | 2015-01-30 10:38:15 +0100 |
|---|---|---|
| committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-30 10:38:15 +0100 |
| commit | b6afdbe8e841e20297a38e2af0a053d8eb26c19b (patch) | |
| tree | 4a336799dcd7d77a7d1f1e9b46b9e48551053524 /kernel/time | |
| parent | 8090f7917b5d7cc2390afe33cb12f819173ef9c8 (diff) | |
| parent | 26bc420b59a38e4e6685a73345a0def461136dce (diff) | |
Merge tag 'v3.19-rc6' into devel
Linux 3.19-rc6
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/ntp.c | 7 | ||||
| -rw-r--r-- | kernel/time/time.c | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 87a346fd6d61..28bf91c60a0b 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -633,6 +633,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; } diff --git a/kernel/time/time.c b/kernel/time/time.c index 6390517e77d4..2c85b7724af4 100644 --- a/kernel/time/time.c +++ b/kernel/time/time.c @@ -196,6 +196,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; } |
