From: Ondřej Surý Date: Wed, 14 Dec 2022 14:07:58 +0000 (+0100) Subject: Expire names in shutdown_names() under the lock X-Git-Tag: v9.19.9~80^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b8c7dc2dc2b4387317aa378e6ee78dbd7459c3cc;p=thirdparty%2Fbind9.git Expire names in shutdown_names() under the lock Since there could be fetches running, we need to run expire_name() under the lock when shutting down the names. --- diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 6f6b2ac78d2..e656c121cc0 100644 --- a/lib/dns/adb.c +++ b/lib/dns/adb.c @@ -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); }