Blame SOURCES/bind-9.11-rh1935152.patch

bad511
From 4757898440d52b0adbf7ec7ee7f0f89b61aac0fb Mon Sep 17 00:00:00 2001
bad511
From: Mark Andrews <marka@isc.org>
bad511
Date: Fri, 18 Dec 2020 13:31:07 +1100
bad511
Subject: [PATCH] Inactive incorrectly incremented
bad511
bad511
It is possible to have two threads destroying an rbtdb at the same
bad511
time when detachnode() executes and removes the last reference to
bad511
a node between exiting being set to true for the node and testing
bad511
if the references are zero in maybe_free_rbtdb().  Move NODE_UNLOCK()
bad511
to after checking if references is zero to prevent detachnode()
bad511
changing the reference count too early.
bad511
bad511
(cherry picked from commit 859d2fdad6d1c6ff20083a4c463a929cbeb26438)
bad511
(cherry picked from commit 25150c15e7cfa73289f04470e2e699ebb7c28fef)
bad511
---
bad511
 lib/dns/rbtdb.c | 2 +-
bad511
 1 file changed, 1 insertion(+), 1 deletion(-)
bad511
bad511
diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c
bad511
index 8ea4d47..77ef7a4 100644
bad511
--- a/lib/dns/rbtdb.c
bad511
+++ b/lib/dns/rbtdb.c
bad511
@@ -1460,11 +1460,11 @@ maybe_free_rbtdb(dns_rbtdb_t *rbtdb) {
bad511
 	for (i = 0; i < rbtdb->node_lock_count; i++) {
bad511
 		NODE_LOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_write);
bad511
 		rbtdb->node_locks[i].exiting = true;
bad511
-		NODE_UNLOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_write);
bad511
 		if (isc_refcount_current(&rbtdb->node_locks[i].references)
bad511
 		    == 0) {
bad511
 			inactive++;
bad511
 		}
bad511
+		NODE_UNLOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_write);
bad511
 	}
bad511
 
bad511
 	if (inactive != 0) {
bad511
-- 
bad511
2.26.3
bad511