Skip to content

Commit

Permalink
ntp: Move timex validation to timekeeping do_adjtimex call.
Browse files Browse the repository at this point in the history
Move logic that does not need the ntp state to be done
in the timekeeping do_adjtimex() call.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
  • Loading branch information
John Stultz committed Apr 4, 2013
1 parent aa6f9c5 commit e408569
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
5 changes: 0 additions & 5 deletions kernel/time/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -668,11 +668,6 @@ int __do_adjtimex(struct timex *txc)
u32 time_tai, orig_tai;
int result;

/* Validate the data before disabling interrupts */
result = ntp_validate_timex(txc);
if (result)
return result;

if (txc->modes & ADJ_SETOFFSET) {
struct timespec delta;
delta.tv_sec = txc->time.tv_sec;
Expand Down
1 change: 1 addition & 0 deletions kernel/time/ntp_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extern void ntp_clear(void);
/* Returns how long ticks are at present, in ns / 2^NTP_SCALE_SHIFT. */
extern u64 ntp_tick_length(void);
extern int second_overflow(unsigned long secs);
extern int ntp_validate_timex(struct timex *);
extern int __do_adjtimex(struct timex *);
extern void __hardpps(const struct timespec *, const struct timespec *);
#endif /* _LINUX_NTP_INTERNAL_H */
7 changes: 7 additions & 0 deletions kernel/time/timekeeping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1618,6 +1618,13 @@ EXPORT_SYMBOL_GPL(ktime_get_monotonic_offset);
*/
int do_adjtimex(struct timex *txc)
{
int ret;

/* Validate the data before disabling interrupts */
ret = ntp_validate_timex(txc);
if (ret)
return ret;

return __do_adjtimex(txc);
}

Expand Down

0 comments on commit e408569

Please sign in to comment.