]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix a lock/unlock bug in server.c:do_modzone()
authorAram Sargsyan <aram@isc.org>
Mon, 13 Apr 2026 16:58:56 +0000 (16:58 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 14 Apr 2026 08:57:12 +0000 (08:57 +0000)
The cleanup path always unlocks the 'view->newzone.lock' lock, but
there are 'goto cleanup;' operations even before the lock is locked,
which causes an assertion failure.

Don't use the cleanup path before the lock is locked.

bin/named/server.c

index 7b676197aa2c95ccaf8591c4e747b6a85c04c689..34ea760143d5b58bb552ecc2d5ad089ad9b7c00c 100644 (file)
@@ -12341,8 +12341,11 @@ do_modzone(named_server_t *server, dns_view_t *view, dns_name_t *name,
 
        if (!view->newzone.allowed) {
                result = ISC_R_NOPERM;
-               TCHECK(putstr(text, "new zone configuration is not allowed"));
-               goto cleanup;
+               tresult = putstr(text, "new zone configuration is not allowed");
+               if (tresult != ISC_R_SUCCESS) {
+                       isc_buffer_clear(text);
+               }
+               return result;
        }
 
        /* Zone must already exist */
@@ -12357,7 +12360,7 @@ do_modzone(named_server_t *server, dns_view_t *view, dns_name_t *name,
                result = dns_view_findzone(view, name, DNS_ZTFIND_EXACT, &zone);
        }
        if (result != ISC_R_SUCCESS) {
-               goto cleanup;
+               return result;
        }
 
        added = dns_zone_getadded(zone);