]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- lock subnet new item before insertion to please checklocks,
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Feb 2018 10:52:44 +0000 (10:52 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Feb 2018 10:52:44 +0000 (10:52 +0000)
  no modification of critical regions outside of lock region.

git-svn-id: file:///svn/unbound/trunk@4497 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
edns-subnet/subnetmod.c

index 11aec5b35a804186c4eeb0af9e33fea5610f7f20..77f6e2036636425b2c347c5e55e47607df47805c 100644 (file)
@@ -2,6 +2,8 @@
        - Fix unfreed locks in log and arc4random at exit of unbound.
        - unit test with valgrind
        - Fix lock race condition in dns cache dname synthesis.
+       - lock subnet new item before insertion to please checklocks,
+         no modification of critical regions outside of lock region.
 
 1 February 2018: Wouter
        - fix unaligned structure making a false positive in checklock
index 4b8a4b2112759aa4f17e22fd6c6ce24945dd341f..bea59ebf506ffb4c30328ba5efcc082cc6d458de 100644 (file)
@@ -339,6 +339,7 @@ update_cache(struct module_qstate *qstate, int id)
                        return;
                }
                lru_entry = &mrep_entry->entry;
+               lock_rw_wrlock(&lru_entry->lock);
                lru_entry->data = calloc(1,
                        sizeof(struct subnet_msg_cache_data));
                if (!lru_entry->data) {
@@ -374,6 +375,7 @@ update_cache(struct module_qstate *qstate, int id)
        if (acquired_lock) {
                lock_rw_unlock(&lru_entry->lock);
        } else {
+               lock_rw_unlock(&lru_entry->lock);
                slabhash_insert(subnet_msg_cache, h, lru_entry, lru_entry->data,
                        NULL);
        }