From 503a172ac9aee4ff87b84b2d870eb0cfc739cb4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Tue, 4 Mar 2025 22:27:01 +0100 Subject: [PATCH] Re-acquire the node when reusing it while deleting dead nodes When the node gets reused in the closeversion cleaning of the dead nodes because the write transaction hasn't been opened yet, it would lead to double call to qpznode_release() on the same node. This is ultimately leads to assertion failure because the reference counting on the erefs would go negative, but the cleaning code is not working as expected thus it went unnoticed. --- lib/dns/qpzone.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/dns/qpzone.c b/lib/dns/qpzone.c index 72050bf96b..383b62bca2 100644 --- a/lib/dns/qpzone.c +++ b/lib/dns/qpzone.c @@ -1597,6 +1597,10 @@ closeversion(dns_db_t *db, dns_dbversion_t **versionp, } } + if (next_changed == changed) { + qpznode_acquire(qpdb, node DNS__DB_FLARG_PASS); + } + qpznode_detach(&node); NODE_UNLOCK(nlock, &nlocktype);