]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
auth zone race condition remove and checklock fix for
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Feb 2018 10:35:11 +0000 (10:35 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Fri, 2 Feb 2018 10:35:11 +0000 (10:35 +0000)
check of unused alignment memory in structure.

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

services/authzone.c
util/data/msgreply.c

index 70a482304efd57eb5dccfa738f2f934d848ce0fb..857c8cb36c718e6914eb27baccfa54a23e87ccd9 100644 (file)
@@ -3874,6 +3874,7 @@ xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env)
 {
        struct auth_zone* z;
        char tmpfile[1024];
+       lock_basic_unlock(&xfr->lock);
 
        /* get lock again, so it is a readlock and concurrently queries
         * can be answered */
@@ -3883,9 +3884,11 @@ xfr_write_after_update(struct auth_xfer* xfr, struct module_env* env)
        if(!z) {
                lock_rw_unlock(&env->auth_zones->lock);
                /* the zone is gone, ignore xfr results */
+               lock_basic_lock(&xfr->lock);
                return;
        }
        lock_rw_rdlock(&z->lock);
+       lock_basic_lock(&xfr->lock);
        lock_rw_unlock(&env->auth_zones->lock);
 
        if(z->zonefile == NULL) {
index dab64d657f112bb871d9b02ef53fbda1676c8d9f..e25b42cc257ab90459a50536a09c5361d18c189d 100644 (file)
@@ -631,7 +631,11 @@ query_info_entrysetup(struct query_info* q, struct reply_info* r,
        e->entry.key = e;
        e->entry.data = r;
        lock_rw_init(&e->entry.lock);
-       lock_protect(&e->entry.lock, &e->key, sizeof(e->key));
+       lock_protect(&e->entry.lock, &e->key.qname, sizeof(e->key.qname));
+       lock_protect(&e->entry.lock, &e->key.qname_len, sizeof(e->key.qname_len));
+       lock_protect(&e->entry.lock, &e->key.qtype, sizeof(e->key.qtype));
+       lock_protect(&e->entry.lock, &e->key.qclass, sizeof(e->key.qclass));
+       lock_protect(&e->entry.lock, &e->key.local_alias, sizeof(e->key.local_alias));
        lock_protect(&e->entry.lock, &e->entry.hash, sizeof(e->entry.hash));
        lock_protect(&e->entry.lock, &e->entry.key, sizeof(e->entry.key));
        lock_protect(&e->entry.lock, &e->entry.data, sizeof(e->entry.data));