]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Address race between zone_maintenance and dns_zone_setview_helper
authorMark Andrews <marka@isc.org>
Thu, 27 Feb 2020 06:29:32 +0000 (17:29 +1100)
committerOndřej Surý <ondrej@isc.org>
Mon, 22 Jun 2020 10:27:11 +0000 (12:27 +0200)
There was a possible NULL dereference due to data race between accessing
zone->view and zone->view->adb.

(cherry picked from commit 67c8f7329de48587c6322e2f077b2b7f476ef41f)

lib/dns/zone.c

index f8d2350b51cdc192169ad3383cc5ba81897be21b..ccadabc03f29db6bc58e85c0f88a872b4c81a634 100644 (file)
@@ -10819,7 +10819,7 @@ zone_maintenance(dns_zone_t *zone) {
        const char me[] = "zone_maintenance";
        isc_time_t now;
        isc_result_t result;
-       bool dumping, load_pending;
+       bool dumping, load_pending, viewok;
 
        REQUIRE(DNS_ZONE_VALID(zone));
        ENTER;
@@ -10842,7 +10842,10 @@ zone_maintenance(dns_zone_t *zone) {
         * adb or resolver will be NULL, and we had better not try
         * to do further maintenance on it.
         */
-       if (zone->view == NULL || zone->view->adb == NULL) {
+       LOCK_ZONE(zone);
+       viewok = (zone->view != NULL && zone->view->adb != NULL);
+       UNLOCK_ZONE(zone);
+       if (!viewok) {
                return;
        }