diff options
author | John Stultz <johnstul@us.ibm.com> | 2012-07-13 01:21:50 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-07-15 03:48:49 -0400 |
commit | 6b1859dba01c7d512b72d77e3fd7da8354235189 (patch) | |
tree | 67eb3bede64476652d1fbd46356e7192fd43b030 /kernel/time/ntp.c | |
parent | 84a1caf1453c3d44050bd22db958af4a7f99315c (diff) |
ntp: Fix STA_INS/DEL clearing bug
In commit 6b43ae8a619d17c4935c3320d2ef9e92bdeed05d, I
introduced a bug that kept the STA_INS or STA_DEL bit
from being cleared from time_status via adjtimex()
without forcing STA_PLL first.
Usually once the STA_INS is set, it isn't cleared
until the leap second is applied, so its unlikely this
affected anyone. However during testing I noticed it
took some effort to cancel a leap second once STA_INS
was set.
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
CC: stable@vger.kernel.org # 3.4
Link: http://lkml.kernel.org/r/1342156917-25092-2-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/ntp.c')
-rw-r--r-- | kernel/time/ntp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 70b33abcc7bb..b7fbadc5c973 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c | |||
@@ -409,7 +409,9 @@ int second_overflow(unsigned long secs) | |||
409 | time_state = TIME_DEL; | 409 | time_state = TIME_DEL; |
410 | break; | 410 | break; |
411 | case TIME_INS: | 411 | case TIME_INS: |
412 | if (secs % 86400 == 0) { | 412 | if (!(time_status & STA_INS)) |
413 | time_state = TIME_OK; | ||
414 | else if (secs % 86400 == 0) { | ||
413 | leap = -1; | 415 | leap = -1; |
414 | time_state = TIME_OOP; | 416 | time_state = TIME_OOP; |
415 | time_tai++; | 417 | time_tai++; |
@@ -418,7 +420,9 @@ int second_overflow(unsigned long secs) | |||
418 | } | 420 | } |
419 | break; | 421 | break; |
420 | case TIME_DEL: | 422 | case TIME_DEL: |
421 | if ((secs + 1) % 86400 == 0) { | 423 | if (!(time_status & STA_DEL)) |
424 | time_state = TIME_OK; | ||
425 | else if ((secs + 1) % 86400 == 0) { | ||
422 | leap = 1; | 426 | leap = 1; |
423 | time_tai--; | 427 | time_tai--; |
424 | time_state = TIME_WAIT; | 428 | time_state = TIME_WAIT; |