diff options
Diffstat (limited to 'drivers/dahdi')
-rw-r--r-- | drivers/dahdi/dahdi-base.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/dahdi/dahdi-base.c b/drivers/dahdi/dahdi-base.c index 511f9c1..2c6fc0d 100644 --- a/drivers/dahdi/dahdi-base.c +++ b/drivers/dahdi/dahdi-base.c @@ -8144,6 +8144,7 @@ static void coretimer_func(unsigned long param) const unsigned long MAX_INTERVAL = 100000L; const unsigned long FOURMS_INTERVAL = HZ/250; const unsigned long ONESEC_INTERVAL = HZ; + const unsigned long MS_LIMIT = 3000; now = current_kernel_time(); @@ -8158,6 +8159,23 @@ static void coretimer_func(unsigned long param) mod_timer(&core_timer.timer, jiffies + FOURMS_INTERVAL); ms_since_start = core_diff_ms(&core_timer.start_interval, &now); + + /* + * 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. + * + */ + if (unlikely((ms_since_start - atomic_read(&core_timer.count)) > MS_LIMIT)) { + if (printk_ratelimit()) + module_printk(KERN_INFO, "Detected time shift.\n"); + atomic_set(&core_timer.count, 0); + atomic_set(&core_timer.last_count, 0); + core_timer.start_interval = now; + return; + } + while (ms_since_start > atomic_read(&core_timer.count)) process_masterspan(); |