From: Wouter Wijngaards Date: Fri, 2 Feb 2018 10:35:11 +0000 (+0000) Subject: auth zone race condition remove and checklock fix for X-Git-Tag: release-1.7.0rc1~65 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a66fd181e5b4882a864af39c57c47ab38cbdd747;p=thirdparty%2Funbound.git auth zone race condition remove and checklock fix for check of unused alignment memory in structure. git-svn-id: file:///svn/unbound/trunk@4496 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/services/authzone.c b/services/authzone.c index 70a482304..857c8cb36 100644 --- a/services/authzone.c +++ b/services/authzone.c @@ -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) { diff --git a/util/data/msgreply.c b/util/data/msgreply.c index dab64d657..e25b42cc2 100644 --- a/util/data/msgreply.c +++ b/util/data/msgreply.c @@ -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));