]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
isc_ratelimiter needs to hold a reference to its task
authorMark Andrews <marka@isc.org>
Wed, 19 Aug 2020 08:45:38 +0000 (18:45 +1000)
committerMark Andrews <marka@isc.org>
Wed, 2 Sep 2020 01:47:37 +0000 (11:47 +1000)
to prevent the task subsystem shutting down before the
ratelimiter is freed.

(cherry picked from commit b8e4b6d30325168bee19e1f05e286c5d3592c4ff)

lib/isc/ratelimiter.c

index 3fd211f6338c5751545790d5f6cddd4726aa1032..1fefe9b25a1edaa5bb1ec5ca842164c9382b0039 100644 (file)
@@ -252,11 +252,14 @@ isc_ratelimiter_shutdown(isc_ratelimiter_t *rl) {
        (void)isc_timer_reset(rl->timer, isc_timertype_inactive,
                              NULL, NULL, false);
        while ((ev = ISC_LIST_HEAD(rl->pending)) != NULL) {
+               task = ev->ev_sender;
                ISC_LIST_UNLINK(rl->pending, ev, ev_ratelink);
                ev->ev_attributes |= ISC_EVENTATTR_CANCELED;
                task = ev->ev_sender;
                isc_task_send(task, &ev);
        }
+       task = NULL;
+       isc_task_attach(rl->task, &task);
        isc_timer_detach(&rl->timer);
 
        /*
@@ -276,6 +279,7 @@ ratelimiter_shutdowncomplete(isc_task_t *task, isc_event_t *event) {
        UNUSED(task);
 
        isc_ratelimiter_detach(&rl);
+       isc_task_detach(&task);
 }
 
 static void