]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Expire names in shutdown_names() under the lock
authorOndřej Surý <ondrej@isc.org>
Wed, 14 Dec 2022 14:07:58 +0000 (15:07 +0100)
committerOndřej Surý <ondrej@isc.org>
Wed, 14 Dec 2022 17:49:18 +0000 (18:49 +0100)
Since there could be fetches running, we need to run expire_name() under
the lock when shutting down the names.

lib/dns/adb.c

index 6f6b2ac78d2f25e453d86ef64f2bf1fa84ab9df7..e656c121cc08dbce85f5db67438f2052c803c70c 100644 (file)
@@ -766,6 +766,8 @@ shutdown_names(dns_adb_t *adb) {
             name = next)
        {
                next = ISC_LIST_NEXT(name, link);
+               dns_adbname_ref(name);
+               LOCK(&name->lock);
                /*
                 * Run through the list.  For each name, clean up finds
                 * found there, and cancel any fetches running.  When
@@ -773,6 +775,8 @@ shutdown_names(dns_adb_t *adb) {
                 * itself.
                 */
                expire_name(name, DNS_EVENT_ADBSHUTDOWN, INT_MAX);
+               UNLOCK(&name->lock);
+               dns_adbname_detach(&name);
        }
        UNLOCK(&adb->names_lock);
 }