]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Handle zone shutting down case in receive_secure_serial()
authorAram Sargsyan <aram@isc.org>
Thu, 7 May 2026 13:31:13 +0000 (13:31 +0000)
committerArаm Sаrgsyаn <aram@isc.org>
Mon, 22 Jun 2026 20:51:53 +0000 (20:51 +0000)
When the zone is shutting down jump straight to cleanup, otherwise
an assertion failure is possible, e.g. because zone->loop can be
already NULL.

lib/dns/zone.c

index 5b1ff55af4ed82f1f5ddc672c011c912f512c7ad..bfb3eec6e16cd316309cd4c25c3414e39a9948ba 100644 (file)
@@ -14391,6 +14391,27 @@ receive_secure_serial(void *arg) {
 
        LOCK_ZONE(zone);
 
+       if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) ||
+           !dns__zone_inline_secure(zone))
+       {
+               /*
+                * If this is a callback for a new secure serial that was
+                * never processed and the zone is shutting down, then just
+                * free 'rss_next' and return.
+                */
+               if (rss == zone->rss_next) {
+                       isc_mem_put(zone->mctx, rss, sizeof(*rss));
+                       zone->rss_next = NULL;
+                       UNLOCK_ZONE(zone);
+                       dns_zone_idetach(&zone);
+                       return;
+               }
+
+               /* Otherwise, this is an ongoing processing, do the cleanup. */
+               UNLOCK_ZONE(zone);
+               CLEANUP(ISC_R_SHUTTINGDOWN);
+       }
+
        /*
         * The receive_secure_serial() is loop-serialized for the zone, but it
         * is possible for new serial to arrive before the old processing is
@@ -14592,7 +14613,7 @@ cleanup:
        if (zone->rss_raw != NULL) {
                dns_zone_detach(&zone->rss_raw);
        }
-       if (result != ISC_R_SUCCESS) {
+       if (result != ISC_R_SUCCESS && result != ISC_R_SHUTTINGDOWN) {
                LOCK_ZONE(zone);
                dns__zone_set_resigntime(zone);
                timenow = isc_time_now();