From 4e1faa35d502cdaf9214e9f00407c9e06500d7c4 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 17 Sep 2021 12:55:07 +1000 Subject: [PATCH] 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. --- lib/dns/zone.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5235e1b610..7bd8c05c9b 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. */