]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix RPZ reference counting error on shutdown
authorAram Sargsyan <aram@isc.org>
Mon, 13 Feb 2023 14:47:09 +0000 (14:47 +0000)
committerAram Sargsyan <aram@isc.org>
Tue, 14 Feb 2023 09:12:53 +0000 (09:12 +0000)
A dns_rpz_unref_rpzs() call is missing when taking the 'goto unlock;'
path on shutdown, in order to compensate for the earlier
dns_rpz_ref_rpzs() call.

Move the dns_rpz_ref_rpzs() call after the shutdown check.

lib/dns/rpz.c

index 70e341a153e24586d246b675dafaacd36ca894aa..8dc62d29e29f91c2b843c518a21d84df7927c16f 100644 (file)
@@ -1945,8 +1945,6 @@ dns__rpz_timer_cb(void *arg) {
        REQUIRE(rpz->updb == NULL);
        REQUIRE(rpz->updbversion == NULL);
 
-       dns_rpz_ref_rpzs(rpz->rpzs);
-
        LOCK(&rpz->rpzs->maint_lock);
 
        if (rpz->rpzs->shuttingdown) {
@@ -1966,6 +1964,7 @@ dns__rpz_timer_cb(void *arg) {
        isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_MASTER,
                      ISC_LOG_INFO, "rpz: %s: reload start", domain);
 
+       dns_rpz_ref_rpzs(rpz->rpzs);
        isc_work_enqueue(rpz->loop, update_rpz_cb, update_rpz_done_cb, rpz);
 
        isc_timer_destroy(&rpz->updatetimer);