Skip to content

Commit

Permalink
- Fix RPZ locking issues on error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphdolmans committed Jan 30, 2020
1 parent 833c4b1 commit b9c9fc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion respip/respip.c
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,7 @@ respip_rewrite_reply(const struct query_info* qinfo,
region, &rpz_used)) {
log_err("out of memory");
lock_rw_unlock(&raddr->lock);
lock_rw_unlock(&az->rpz_lock);
return 0;
}
if(!rpz_used) {
Expand Down Expand Up @@ -1099,7 +1100,6 @@ respip_operate(struct module_qstate* qstate, enum module_ev event, int id,
if (actinfo.action == respip_always_deny ||
(new_rep == qstate->return_msg->rep &&
(actinfo.action == respip_deny ||
actinfo.action == respip_deny ||
actinfo.action == respip_inform_deny))) {
/* for deny-variant actions (unless response-ip
* data is applied), mark the query state so
Expand Down
6 changes: 6 additions & 0 deletions services/rpz.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,11 +681,17 @@ rpz_find_zone(struct rpz* r, uint8_t* qname, size_t qname_len, uint16_t qclass,
ce = dname_get_shared_topdomain(z->name, qname);
if(!ce /* should not happen */ || !*ce /* root */) {
lock_rw_unlock(&z->lock);
if(zones_keep_lock) {
lock_rw_unlock(&r->local_zones->lock);
}
return NULL;
}
ce_labs = dname_count_size_labels(ce, &ce_len);
if(ce_len+2 > sizeof(wc)) {
lock_rw_unlock(&z->lock);
if(zones_keep_lock) {
lock_rw_unlock(&r->local_zones->lock);
}
return NULL;
}
wc[0] = 1; /* length of wildcard label */
Expand Down

0 comments on commit b9c9fc0

Please sign in to comment.