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
This commit is contained in:
Wouter Wijngaards 2018-02-02 10:35:11 +00:00
parent cb28d35bd2
commit a66fd181e5
2 changed files with 8 additions and 1 deletions

View 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) {

View 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));