From b8c7dc2dc2b4387317aa378e6ee78dbd7459c3cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Wed, 14 Dec 2022 15:07:58 +0100 Subject: [PATCH] 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. --- lib/dns/adb.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dns/adb.c b/lib/dns/adb.c index 6f6b2ac78d..e656c121cc 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); }