Message ID | 1425303478-2024-1-git-send-email-luis.henriques@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 33db43a39515..3fca3fdd7c82 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -632,6 +632,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; }