From e3d4d34744760b2697912a1cbee90658b8f81ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Mon, 9 Jan 2023 12:48:19 +0100 Subject: [PATCH] Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree() In the previous refactoring, the findnodeintree() function could return ISC_R_EXISTS (from dns_db_addnode() call) instead of ISC_R_SUCCESS leading to node being attached, but never detached. Change the ISC_R_EXISTS result code returned from dns_rbt_addnode() to the ISC_R_SUCCESS in the findnodeintree() function (called internally by dns_db_findnode() and dns_db_findnsec3node()). --- lib/dns/rbtdb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 4850bc148d..eea89880d4 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -2818,7 +2818,9 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name, if (tree == rbtdb->nsec3) { node->nsec = DNS_RBT_NSEC_NSEC3; } - } else if (result != ISC_R_EXISTS) { + } else if (result == ISC_R_EXISTS) { + result = ISC_R_SUCCESS; + } else { goto unlock; } } @@ -2830,7 +2832,6 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name, reactivate_node(rbtdb, node, tlocktype); *nodep = (dns_dbnode_t *)node; - unlock: TREE_UNLOCK(&rbtdb->tree_lock, &tlocktype);