From: Mark Andrews Date: Tue, 29 Dec 2009 22:04:16 +0000 (+0000) Subject: 2823. [bug] rbtdb.c:getsigningtime() was missing locks. [RT #20781] X-Git-Tag: v9.4.3-P1~2^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=288486df9df0c5a39b3c3d625c7f133d9a8e69fb;p=thirdparty%2Fbind9.git 2823. [bug] rbtdb.c:getsigningtime() was missing locks. [RT #20781] --- diff --git a/CHANGES b/CHANGES index 5c9b839c7db..ac9e8315658 100644 --- a/CHANGES +++ b/CHANGES @@ -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] diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index f0f2cac1f5f..c8c8c5fe841 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -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)