From: Mark Andrews Date: Fri, 17 Sep 2021 02:55:07 +0000 (+1000) Subject: Pause the dbiterator before calling dns_db_find X-Git-Tag: v9.17.19~22^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4e1faa35d502cdaf9214e9f00407c9e06500d7c4;p=thirdparty%2Fbind9.git Pause the dbiterator before calling dns_db_find zone.c:integrity_checks() acquires a read lock while iterating the zone database, and calls zone_check_mx() which acquires another read lock. If another thread tries to acquire a write lock in the meantime, it can deadlock. Calling dns_dbiterator_pause() to release the first read lock prevents this. --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5235e1b610d..7bd8c05c9b6 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -3326,6 +3326,8 @@ integrity_checks(dns_zone_t *zone, dns_db_t *db) { goto next; } + dns_dbiterator_pause(dbiterator); + /* * Don't check the NS records at the origin. */