]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a data race in dns_zone_getxfrintime()
authorAram Sargsyan <aram@isc.org>
Mon, 7 Oct 2024 12:26:59 +0000 (12:26 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Wed, 9 Oct 2024 09:13:04 +0000 (09:13 +0000)
The dns_zone_getxfrintime() function fails to lock the zone before
accessing its 'xfrintime' structure member, which can cause a data
race between soa_query() and the statistics channel. Add the missing
locking/unlocking pair, like it's done in numerous other similar
functions.

lib/dns/include/dns/zone.h
lib/dns/zone.c

index 86f2f36329f3634e8976b5a956cd602af6604de9..e30ac2f73f91a98610243bbf0a8ca270ed667e02 100644 (file)
@@ -1555,7 +1555,7 @@ dns_zone_getprimaryaddr(dns_zone_t *zone);
  */
 
 isc_time_t
-dns_zone_getxfrintime(const dns_zone_t *zone);
+dns_zone_getxfrintime(dns_zone_t *zone);
 /*%<
  * Get the start time of the zone's latest major step before an incoming zone
  * transfer is initiated. The time is set to the current time before the
index f1567be0ba84b4521a06688ea1f1d62a19dd4216..51eb23890a3a44ec057b4fc9cee1eba5de031532 100644 (file)
@@ -18169,10 +18169,16 @@ dns_zone_getprimaryaddr(dns_zone_t *zone) {
 }
 
 isc_time_t
-dns_zone_getxfrintime(const dns_zone_t *zone) {
+dns_zone_getxfrintime(dns_zone_t *zone) {
+       isc_time_t xfrintime;
+
        REQUIRE(DNS_ZONE_VALID(zone));
 
-       return (zone->xfrintime);
+       LOCK_ZONE(zone);
+       xfrintime = zone->xfrintime;
+       UNLOCK_ZONE(zone);
+
+       return (xfrintime);
 }
 
 static void