aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2012-07-13 01:21:50 -0400
committerLuis Henriques <luis.henriques@canonical.com>2012-08-13 09:10:24 -0400
commit3933d67df7fe96ae203ab24dd1e25eb264b1f445 (patch)
treeea9ef6a9faa61b2fa1e22432bcbae4b6fc56afad
parente0c453ebfbe880d5009d561a87684d9a55bd0edb (diff)
ntp: Fix STA_INS/DEL clearing bug
BugLink: http://bugs.launchpad.net/bugs/1031926 commit 6b1859dba01c7d512b72d77e3fd7da8354235189 upstream. 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> Link: http://lkml.kernel.org/r/1342156917-25092-2-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
-rw-r--r--kernel/time/ntp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index f1eb182b5fe..61fc450643b 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -375,7 +375,9 @@ int second_overflow(unsigned long secs)
375 time_state = TIME_DEL; 375 time_state = TIME_DEL;
376 break; 376 break;
377 case TIME_INS: 377 case TIME_INS:
378 if (secs % 86400 == 0) { 378 if (!(time_status & STA_INS))
379 time_state = TIME_OK;
380 else if (secs % 86400 == 0) {
379 leap = -1; 381 leap = -1;
380 time_state = TIME_OOP; 382 time_state = TIME_OOP;
381 time_tai++; 383 time_tai++;
@@ -384,7 +386,9 @@ int second_overflow(unsigned long secs)
384 } 386 }
385 break; 387 break;
386 case TIME_DEL: 388 case TIME_DEL:
387 if ((secs + 1) % 86400 == 0) { 389 if (!(time_status & STA_DEL))
390 time_state = TIME_OK;
391 else if ((secs + 1) % 86400 == 0) {
388 leap = 1; 392 leap = 1;
389 time_tai--; 393 time_tai--;
390 time_state = TIME_WAIT; 394 time_state = TIME_WAIT;