]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Unlink the timer event before trying to purge it
authorMark Andrews <marka@isc.org>
Wed, 6 Apr 2022 05:52:24 +0000 (15:52 +1000)
committerMark Andrews <marka@isc.org>
Wed, 6 Apr 2022 07:33:41 +0000 (07:33 +0000)
as far as I can determine the order of operations is not important.

    *** CID 351372:  Concurrent data access violations  (ATOMICITY)
    /lib/isc/timer.c: 227 in timer_purge()
    221      LOCK(&timer->lock);
    222      if (!purged) {
    223      /*
    224       * The event has already been executed, but not
    225       * yet destroyed.
    226       */
    >>>     CID 351372:  Concurrent data access violations  (ATOMICITY)
    >>>     Using an unreliable value of "event" inside the second locked section. If the data that "event" depends on was changed by another thread, this use might be incorrect.
    227      timerevent_unlink(timer, event);
    228      }
    229      }
    230     }
    231
    232     void

lib/isc/timer.c

index b2f6c0b1c1e492a3a8aa350ceeb5d42cacd02cc9..68984fd5e95663850d02da4204a5b7038c718b76 100644 (file)
@@ -215,17 +215,10 @@ timer_purge(isc_timer_t *timer) {
        isc_timerevent_t *event = NULL;
 
        while ((event = ISC_LIST_HEAD(timer->active)) != NULL) {
+               timerevent_unlink(timer, event);
                UNLOCK(&timer->lock);
-               bool purged = isc_task_purgeevent(timer->task,
-                                                 (isc_event_t *)event);
+               (void)isc_task_purgeevent(timer->task, (isc_event_t *)event);
                LOCK(&timer->lock);
-               if (!purged) {
-                       /*
-                        * The event has already been executed, but not
-                        * yet destroyed.
-                        */
-                       timerevent_unlink(timer, event);
-               }
        }
 }