]> git.ipfire.org Git - thirdparty/bind9.git/commit
Prevent a race after zone load
authorMichał Kępień <michal@isc.org>
Mon, 24 Sep 2018 17:33:16 +0000 (19:33 +0200)
committerEvan Hunt <each@isc.org>
Thu, 27 Sep 2018 02:46:21 +0000 (19:46 -0700)
commit74cd632f18758d40cf93bdc64b413234fc911ee3
tree01d7be4d4c095a1bda6b9225afaf52c1f12410ca
parent696d9d9bacf8920e2c01daa2bcb675a7bb4a8631
Prevent a race after zone load

Zone loading happens in a different task (zone->loadtask) than other
zone actions (zone->task).  Thus, when zone_postload() is called in the
context of zone->loadtask, it may cause zone maintenance to be queued in
zone->task and another thread can then execute zone_maintenance() before
zone_postload() gets a chance to finish its work in the first thread.
This would not be a problem if zone_maintenance() accounted for this
possibility by locking the zone before checking the state of its
DNS_ZONEFLG_LOADPENDING flag.  However, the zone is currently not locked
before the state of that flag is checked, which may prevent zone
maintenance from happening despite zone_postload() scheduling it.  Fix
by locking the zone in zone_maintenance() before checking the state of
the zone's DNS_ZONEFLG_LOADPENDING flag.

(cherry picked from commit 56003e9f9f72c8be67d553f4dbd16eba849ca864)
lib/dns/zone.c