From: Ondřej Surý Date: Tue, 25 Feb 2025 11:13:56 +0000 (+0100) Subject: Destroy the hashmap iterator inside the rwlock X-Git-Tag: ondrej/lock-free-qpzone-reads-v1~29^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e4fb53c6142d0148be782aede47bebd8e00d5b2;p=thirdparty%2Fbind9.git Destroy the hashmap iterator inside the rwlock 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. --- diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 7712f790b74..962b79109b3 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -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; }