From: Ondřej Surý Date: Mon, 9 Jan 2023 11:48:19 +0000 (+0100) Subject: Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree() X-Git-Tag: v9.19.9~40^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e3d4d34744760b2697912a1cbee90658b8f81ff7;p=thirdparty%2Fbind9.git 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()). --- diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index 4850bc148da..eea89880d45 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);