]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix a race between resolver query timeout and validation
authorAram Sargsyan <aram@isc.org>
Fri, 10 Jun 2022 14:44:52 +0000 (14:44 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 30 Jun 2022 18:58:58 +0000 (18:58 +0000)
commit058a2e7d4437f383c5cda3a44921e49ad272f9fb
treedcba857d0b3760f9e5369664ba93d5bf492ec2f9
parentb56317fc564d7969c5a90b5526ebe3f5fc55f972
Fix a race between resolver query timeout and validation

The `resolver.c:validated()` function unlinks the current validator from
the fetch's validators list, which can leave it empty, then unlocks
the bucket lock. If, by a chance, the fetch was timed out just before
the `validated()` call, the final timeout callback running in parallel
with `validated()` can find the fetch context with no active fetches
and with an empty validators list and destroy it, which is unexpected
for the `validated()` function and can lead to a crash.

Increase the fetch context's reference count in the beginning of
`validated()` and decrease it when it finishes its work to avoid the
unexpected destruction of the fetch context.
lib/dns/resolver.c