]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Destroy the hashmap iterator inside the rwlock
authorOndřej Surý <ondrej@isc.org>
Tue, 25 Feb 2025 11:13:56 +0000 (12:13 +0100)
committerOndřej Surý <ondrej@isc.org>
Tue, 25 Feb 2025 12:36:37 +0000 (13:36 +0100)
Previously, the hashmap iterator for fetches-per-zone was destroy
outside the rwlock.  This could lead to an assertion failure due to a
timing race with the internal rehashing of the hashmap table as the
rehashing process requires no iterators to be running when rehashing the
hashmap table.  This has been fixed by moving the destruction of the
iterator inside the read locked section.

lib/dns/resolver.c

index 7712f790b74668981ab42e68279cffaa0ccc78d6..962b79109b38046a460d11eae16452374d45d30a 100644 (file)
@@ -11048,8 +11048,8 @@ dns_resolver_dumpquota(dns_resolver_t *res, isc_buffer_t **buf) {
        }
 
 cleanup:
-       RWUNLOCK(&res->counters_lock, isc_rwlocktype_read);
        isc_hashmap_iter_destroy(&it);
+       RWUNLOCK(&res->counters_lock, isc_rwlocktype_read);
        return result;
 }