From: Aram Sargsyan Date: Thu, 7 May 2026 13:31:13 +0000 (+0000) Subject: Handle zone shutting down case in receive_secure_serial() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b56e3cd2ee1489b1482a6706d8e6073ac96b2625;p=thirdparty%2Fbind9.git Handle zone shutting down case in receive_secure_serial() 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. --- diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 5b1ff55af4e..bfb3eec6e16 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -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();