From 1c42df4cd18346c9e2adff6f202bb5ae715ff60b Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Mon, 4 Apr 2011 16:24:26 +0000 Subject: [PATCH] core timer: don't hang when the clock goes back. If the clock shifts back, don't hang in a loop of running process_masterspan from the timer interrupt forever. Fixes a regression of r9407. (closes issue #19035) Reported by: tzafrir Signed-off-by: Tzafrir Cohen After talking with Tzafrir on IRC, I combined the check if your far ahead with the check if you're behind and added a '\n' at the end of the existing "detected time shift" message. That is why this patch is different than what is posted on issue #19035. Acked-by: Shaun Ruffell Acked-by: Michael Spiceland Acked-by: Kinsey Moore git-svn-id: http://svn.asterisk.org/svn/dahdi/linux/trunk@9876 a0bf4364-ded3-4de4-8d8a-66a801d63aff --- drivers/dahdi/dahdi-base.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 8a634d3..218f87f 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8971,15 +8971,15 @@ static void coretimer_func(unsigned long param) /* * If the system time has changed, it is possible for us to be * far behind. If we are more than MS_LIMIT milliseconds - * behind, just reset our time base and continue so that we do - * not hang the system here. + * behind (or ahead in time), just reset our time base and + * continue so that we do not hang the system here. * */ difference = ms_since_start - msecs_processed(&core_timer); - if (unlikely(difference > MS_LIMIT)) { + if (unlikely((difference > MS_LIMIT) || (difference < 0))) { if (printk_ratelimit()) { module_printk(KERN_INFO, - "Detected time shift."); + "Detected time shift.\n"); } atomic_set(&core_timer.count, 0); atomic_set(&core_timer.last_count, 0);