]> 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 03:26:29 +0000 (13:26 +1000)
(cherry picked from commit bcaf23dd2799e30cfee1b5d39dec0fbc8e5f7193)

bin/dnssec/dnssec-signzone.c
lib/isc/rwlock.c

index e321295684d6b70882541f0e2852f1a0a8855124..6cea5138d21cdbcc7bc127275d5363ed3975568f 100644 (file)
@@ -126,7 +126,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;
@@ -385,9 +385,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 7984a63042223a3878e34c27796d5dc55547a198..9f732b3aaa74d98611efad5f74918ae67af49038 100644 (file)
@@ -112,9 +112,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);
 }