mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Ensure tree lock is always held when dns_rbt_fullnamefromnode is called
This commit is contained in:
@@ -561,6 +561,8 @@ rdataset_addglue(dns_rdataset_t *rdataset, dns_dbversion_t *version,
|
|||||||
dns_message_t *msg);
|
dns_message_t *msg);
|
||||||
static void
|
static void
|
||||||
free_gluetable(rbtdb_version_t *version);
|
free_gluetable(rbtdb_version_t *version);
|
||||||
|
static isc_result_t
|
||||||
|
nodefullname(dns_db_t *db, dns_dbnode_t *node, dns_name_t *name);
|
||||||
|
|
||||||
static dns_rdatasetmethods_t rdataset_methods = { rdataset_disassociate,
|
static dns_rdatasetmethods_t rdataset_methods = { rdataset_disassociate,
|
||||||
rdataset_first,
|
rdataset_first,
|
||||||
@@ -6665,9 +6667,7 @@ addrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
}
|
}
|
||||||
|
|
||||||
name = dns_fixedname_initname(&fixed);
|
name = dns_fixedname_initname(&fixed);
|
||||||
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
nodefullname(db, node, name);
|
||||||
dns_rbt_fullnamefromnode(rbtnode, name);
|
|
||||||
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
|
||||||
dns_rdataset_getownercase(rdataset, name);
|
dns_rdataset_getownercase(rdataset, name);
|
||||||
|
|
||||||
newheader = (rdatasetheader_t *)region.base;
|
newheader = (rdatasetheader_t *)region.base;
|
||||||
@@ -6865,8 +6865,6 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
REQUIRE(VALID_RBTDB(rbtdb));
|
REQUIRE(VALID_RBTDB(rbtdb));
|
||||||
REQUIRE(rbtversion != NULL && rbtversion->rbtdb == rbtdb);
|
REQUIRE(rbtversion != NULL && rbtversion->rbtdb == rbtdb);
|
||||||
|
|
||||||
dns_rbt_fullnamefromnode(rbtnode, nodename);
|
|
||||||
|
|
||||||
if (rbtdb->common.methods == &zone_methods) {
|
if (rbtdb->common.methods == &zone_methods) {
|
||||||
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
RWLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
||||||
REQUIRE(((rbtnode->nsec == DNS_RBT_NSEC_NSEC3 &&
|
REQUIRE(((rbtnode->nsec == DNS_RBT_NSEC_NSEC3 &&
|
||||||
@@ -6878,6 +6876,8 @@ subtractrdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nodefullname(db, node, nodename);
|
||||||
|
|
||||||
result = dns_rdataslab_fromrdataset(rdataset, rbtdb->common.mctx,
|
result = dns_rdataslab_fromrdataset(rdataset, rbtdb->common.mctx,
|
||||||
®ion, sizeof(rdatasetheader_t));
|
®ion, sizeof(rdatasetheader_t));
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@@ -7113,13 +7113,12 @@ deleterdataset(dns_db_t *db, dns_dbnode_t *node, dns_dbversion_t *version,
|
|||||||
newheader->last_used = 0;
|
newheader->last_used = 0;
|
||||||
newheader->node = rbtnode;
|
newheader->node = rbtnode;
|
||||||
|
|
||||||
|
nodefullname(db, node, nodename);
|
||||||
|
|
||||||
NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
|
NODE_LOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
|
||||||
isc_rwlocktype_write);
|
isc_rwlocktype_write);
|
||||||
|
|
||||||
dns_rbt_fullnamefromnode(rbtnode, nodename);
|
|
||||||
result = add32(rbtdb, rbtnode, nodename, rbtversion, newheader,
|
result = add32(rbtdb, rbtnode, nodename, rbtversion, newheader,
|
||||||
DNS_DBADD_FORCE, false, NULL, 0);
|
DNS_DBADD_FORCE, false, NULL, 0);
|
||||||
|
|
||||||
NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
|
NODE_UNLOCK(&rbtdb->node_locks[rbtnode->locknum].lock,
|
||||||
isc_rwlocktype_write);
|
isc_rwlocktype_write);
|
||||||
|
|
||||||
@@ -7228,12 +7227,6 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
|
|
||||||
REQUIRE(rdataset->rdclass == rbtdb->common.rdclass);
|
REQUIRE(rdataset->rdclass == rbtdb->common.rdclass);
|
||||||
|
|
||||||
/*
|
|
||||||
* This routine does no node locking. See comments in
|
|
||||||
* 'load' below for more information on loading and
|
|
||||||
* locking.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SOA records are only allowed at top of zone.
|
* SOA records are only allowed at top of zone.
|
||||||
*/
|
*/
|
||||||
@@ -7285,9 +7278,6 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
if (result == ISC_R_SUCCESS) {
|
if (result == ISC_R_SUCCESS) {
|
||||||
dns_name_t foundname;
|
|
||||||
dns_name_init(&foundname, NULL);
|
|
||||||
dns_rbt_namefromnode(node, &foundname);
|
|
||||||
node->locknum = node->hashval % rbtdb->node_lock_count;
|
node->locknum = node->hashval % rbtdb->node_lock_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7324,10 +7314,8 @@ loading_addrdataset(void *arg, const dns_name_t *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
NODE_LOCK(&rbtdb->node_locks[node->locknum].lock, isc_rwlocktype_write);
|
NODE_LOCK(&rbtdb->node_locks[node->locknum].lock, isc_rwlocktype_write);
|
||||||
|
|
||||||
result = add32(rbtdb, node, name, rbtdb->current_version, newheader,
|
result = add32(rbtdb, node, name, rbtdb->current_version, newheader,
|
||||||
DNS_DBADD_MERGE, true, NULL, 0);
|
DNS_DBADD_MERGE, true, NULL, 0);
|
||||||
|
|
||||||
NODE_UNLOCK(&rbtdb->node_locks[node->locknum].lock,
|
NODE_UNLOCK(&rbtdb->node_locks[node->locknum].lock,
|
||||||
isc_rwlocktype_write);
|
isc_rwlocktype_write);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user