]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Stop the timer when shuttingdown the fetch context
authorOndřej Surý <ondrej@isc.org>
Thu, 23 Jan 2025 16:04:24 +0000 (17:04 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 23 Jan 2025 16:46:37 +0000 (17:46 +0100)
When canceling the last fetch, we also need to stop the fctx_expired
timer from possibly firing between the fctx_shutdown() call and the
fetch being actually destroyed along with the timer.  As there are
multiple places where fctx_shutdown() is being called without stopping
the timer, move the fctx_stoptimer() to fctx_shutdown() and cleanup the
explicit usage.

lib/dns/resolver.c

index 2178a17b5e9be5d288a24029ee9101a90e9b3b76..145dfeff15eadf4b3a6a8ebae485acde3677da95 100644 (file)
@@ -1981,7 +1981,6 @@ fctx__done_detach(fetchctx_t **fctxp, isc_result_t result, const char *file,
        fctx->qmin_warning = ISC_R_SUCCESS;
 
        fctx_cancelqueries(fctx, no_response, age_untried);
-       fctx_stoptimer(fctx);
 
        LOCK(&res->buckets[fctx->bucketnum].lock);
        FCTX_ATTR_CLR(fctx, FCTX_ATTR_ADDRWAIT);
@@ -4688,6 +4687,8 @@ fctx_shutdown(fetchctx_t *fctx) {
         * exit.
         */
        if (fctx->state != fetchstate_init) {
+               fctx_stoptimer(fctx);
+
                FCTXTRACE("posting control event");
                cevent = &fctx->control_event;
                isc_task_sendto(fctx->res->buckets[fctx->bucketnum].task,