Bug 1201 - missing unlock in answer_from_cache() (?)
missing unlock in answer_from_cache() (?)
Product: unbound
Classification: Unclassified
Component: server
Other All
: P5 enhancement
Assigned To: unbound team
Depends on:
  Show dependency treegraph
Reported: 2017-01-06 16:45 CET by JINMEI Tatuya
Modified: 2017-01-06 16:51 CET (History)
2 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
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