Skip to content

[9.18] Fix a lock-order-inversion bug in resolver.c

There is a lock-order-inversion (potential deadlock) in resolver.c, because in dns_resolver_shutdown() a resolver bucket lock is locked while the resolver lock itself is already locked, while in fctx_sendevents() the resolver lock is locked while a bucket lock is locked before calling that function in fctx__done_detach().

The resolver lock/unlock in dns_resolver_shutdown() was added back in the 317e36d4 commit to make sure that the function is finished before the resolver object is destroyed.

Since res->exiting is atomic, it should be possible to move the resolver locking down in the code, when the bucket lock is already unlocked.

Closes #4106 (closed)

Merge request reports