]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix unchecked return of isc_rwlock_lock and isc_rwlock_unlock
authorMark Andrews <marka@isc.org>
Wed, 7 Jul 2021 05:47:59 +0000 (15:47 +1000)
committerMark Andrews <marka@isc.org>
Mon, 12 Jul 2021 02:40:25 +0000 (02:40 +0000)
bin/dnssec/dnssec-signzone.c
lib/isc/rwlock.c

index 140c91a302d8aa18e0fd3c9597b085a061a100c2..9beab17988a0839d26e28b10303b931807a1915b 100644 (file)
@@ -124,7 +124,7 @@ struct signer_event {
 
 static dns_dnsseckeylist_t keylist;
 static unsigned int keycount = 0;
-isc_rwlock_t keylist_lock;
+static isc_rwlock_t keylist_lock;
 static isc_stdtime_t starttime = 0, endtime = 0, dnskey_endtime = 0, now;
 static int cycle = -1;
 static int jitter = 0;
@@ -383,9 +383,9 @@ keythatsigned(dns_rdata_rrsig_t *rrsig) {
        dst_key_t *pubkey = NULL, *privkey = NULL;
        dns_dnsseckey_t *key = NULL;
 
-       isc_rwlock_lock(&keylist_lock, isc_rwlocktype_read);
+       RWLOCK(&keylist_lock, isc_rwlocktype_read);
        key = keythatsigned_unlocked(rrsig);
-       isc_rwlock_unlock(&keylist_lock, isc_rwlocktype_read);
+       RWUNLOCK(&keylist_lock, isc_rwlocktype_read);
        if (key != NULL) {
                return (key);
        }
index 3441ce5c140f495386099ec05cf45a40ac0c6d36..17bebda90efc666e9158b63e6f1af8bc1a416f1a 100644 (file)
@@ -113,9 +113,12 @@ isc_rwlock_tryupgrade(isc_rwlock_t *rwl) {
 
 void
 isc_rwlock_downgrade(isc_rwlock_t *rwl) {
+       isc_result_t result;
        atomic_store_release(&rwl->downgrade, true);
-       isc_rwlock_unlock(rwl, isc_rwlocktype_write);
-       isc_rwlock_lock(rwl, isc_rwlocktype_read);
+       result = isc_rwlock_unlock(rwl, isc_rwlocktype_write);
+       RUNTIME_CHECK(result == ISC_R_SUCCESS);
+       result = isc_rwlock_lock(rwl, isc_rwlocktype_read);
+       RUNTIME_CHECK(result == ISC_R_SUCCESS);
        atomic_store_release(&rwl->downgrade, false);
 }