Author: davidxu
Date: Sat Oct 25 11:37:42 2008
New Revision: 184259
URL: http://svn.freebsd.org/changeset/base/184259

Log:
  Merge revision 184067 from head to stable/7:
  
        In realtimer_delete(), clear timer's value and interval to tell
        realtimer_expire() to not rearm the timer, otherwise there is a
        chance that a callout will be left there and be tiggered in future
        unexpectly.
  
  Approved by:  re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/kern/kern_time.c

Modified: stable/7/sys/kern/kern_time.c
==============================================================================
--- stable/7/sys/kern/kern_time.c       Sat Oct 25 10:55:49 2008        
(r184258)
+++ stable/7/sys/kern/kern_time.c       Sat Oct 25 11:37:42 2008        
(r184259)
@@ -1225,6 +1225,12 @@ realtimer_delete(struct itimer *it)
 {
        mtx_assert(&it->it_mtx, MA_OWNED);
        
+       /*
+        * clear timer's value and interval to tell realtimer_expire
+        * to not rearm the timer.
+        */
+       timespecclear(&it->it_time.it_value);
+       timespecclear(&it->it_time.it_interval);
        ITIMER_UNLOCK(it);
        callout_drain(&it->it_callout);
        ITIMER_LOCK(it);
@@ -1374,9 +1380,11 @@ realtimer_expire(void *arg)
                        callout_reset(&it->it_callout, tvtohz(&tv),
                                 realtimer_expire, it);
                }
+               itimer_enter(it);
                ITIMER_UNLOCK(it);
                itimer_fire(it);
                ITIMER_LOCK(it);
+               itimer_leave(it);
        } else if (timespecisset(&it->it_time.it_value)) {
                ts = it->it_time.it_value;
                timespecsub(&ts, &cts);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to