Message ID | 1460651114-3003-1-git-send-email-tim.gardner@canonical.com |
---|---|
State | New |
Headers | show |
Think I saw that happen in the logs... so testable
> Stefan Bader <stefan.bader@canonical.com> hat am 15. April 2016 um 10:00 > geschrieben: > > > Think I saw that happen in the logs... so testable > Proposed patch fixes the problem (tested with 4.4.0-17.33).
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index d7654e2..ab86177 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -679,8 +679,18 @@ int ntp_validate_timex(struct timex *txc) if (!capable(CAP_SYS_TIME)) return -EPERM; - if (!timeval_inject_offset_valid(&txc->time)) - return -EINVAL; + if (txc->modes & ADJ_NANO) { + struct timespec ts; + + ts.tv_sec = txc->time.tv_sec; + ts.tv_nsec = txc->time.tv_usec; + if (!timespec_inject_offset_valid(&ts)) + return -EINVAL; + + } else { + if (!timeval_inject_offset_valid(&txc->time)) + return -EINVAL; + } } /*