]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Pause the dbiterator before calling dns_db_find
authorMark Andrews <marka@isc.org>
Fri, 17 Sep 2021 02:55:07 +0000 (12:55 +1000)
committerOndřej Surý <ondrej@sury.org>
Wed, 29 Sep 2021 16:04:14 +0000 (18:04 +0200)
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.

(cherry picked from commit 4e1faa35d502cdaf9214e9f00407c9e06500d7c4)

lib/dns/zone.c

index 5ec499d2c59f446fa8cc2881df5b51a2b1c1b6bb..cbe8457ae7d380642066deaec7f408b6ccae4eef 100644 (file)
@@ -3285,6 +3285,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.
                 */