Bug 1201

Summary: missing unlock in answer_from_cache() (?)
Product: unbound Reporter: JINMEI Tatuya <jtatuya>
Component: serverAssignee: unbound team <unbound-team>
Severity: enhancement CC: cathya, wouter
Priority: P5    
Version: unspecified   
Hardware: Other   
OS: All   

Description JINMEI Tatuya 2017-01-06 16:45:13 CET
Just from code inspection, but I suspect the following exit code paths
from daemon/worker.c:answer_from_cache lack necessary unlocking of mutex.

		if(!inplace_cb_reply_servfail_call(&worker->env, qinfo, NULL, rep,
			LDNS_RCODE_SERVFAIL, edns, worker->scratchpad))
				return 0;
	if(!inplace_cb_reply_cache_call(&worker->env, qinfo, NULL, rep,
		(int)(flags&LDNS_RCODE_MASK), edns, worker->scratchpad))
			return 0;

I suspect it should either call rrset_array_unlock_touch() before
return or go to 'bail_out' instead of return.

(the inplace_cb_reply_xxx functions don't seem to unlock the rrset
array either).

This is about svn trunk rev 3982.
Comment 1 Wouter Wijngaards 2017-01-06 16:51:40 CET
Hi Jinmei,

That is very well spotted.  Thank you for the report.

I have made it goto the bail_out; that should be exactly fine.  Those routines couldn't return false before (well, before people implement EDNS options).

Best regards, Wouter