2823. [bug] rbtdb.c:getsigningtime() was missing locks. [RT #20781]

This commit is contained in:
Mark Andrews 2009-12-29 22:04:16 +00:00
parent d4c0bf0a08
commit 288486df9d
2 changed files with 16 additions and 6 deletions

View file

@ -1,3 +1,5 @@
2823. [bug] rbtdb.c:getsigningtime() was missing locks. [RT #20781]
2822. [bug] rbtdb.c:loadnode() could return the wrong result.
[RT #20802]

View file

@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rbtdb.c,v 1.294 2009/12/29 08:53:33 marka Exp $ */
/* $Id: rbtdb.c,v 1.295 2009/12/29 22:04:16 marka Exp $ */
/*! \file */
@ -6952,27 +6952,35 @@ getsigningtime(dns_db_t *db, dns_rdataset_t *rdataset,
rdatasetheader_t *header = NULL, *this;
unsigned int i;
isc_result_t result = ISC_R_NOTFOUND;
unsigned int locknum;
REQUIRE(VALID_RBTDB(rbtdb));
RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_read);
for (i = 0; i < rbtdb->node_lock_count; i++) {
NODE_LOCK(&rbtdb->node_locks[i].lock, isc_rwlocktype_read);
this = isc_heap_element(rbtdb->heaps[i], 1);
if (this == NULL)
if (this == NULL) {
NODE_UNLOCK(&rbtdb->node_locks[i].lock,
isc_rwlocktype_read);
continue;
}
if (header == NULL)
header = this;
else if (isc_serial_lt(this->resign, header->resign))
else if (isc_serial_lt(this->resign, header->resign)) {
locknum = header->node->locknum;
NODE_UNLOCK(&rbtdb->node_locks[locknum].lock,
isc_rwlocktype_read);
header = this;
} else
NODE_UNLOCK(&rbtdb->node_locks[i].lock,
isc_rwlocktype_read);
}
if (header == NULL)
goto unlock;
NODE_LOCK(&rbtdb->node_locks[header->node->locknum].lock,
isc_rwlocktype_read);
bind_rdataset(rbtdb, header->node, header, 0, rdataset);
if (foundname != NULL)