]> 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 11:21:40 +0000 (11:21 +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.

(cherry picked from commit afbe63565fa444f13359425554c871cc924d9547)

lib/dns/rpz.c

index dbdf6a05fca0726fc9af472bd2a9663ece752c91..a29b6f8e3d568b1fb189d851291f8ce9ab4dad94 100644 (file)
@@ -1957,8 +1957,6 @@ dns__rpz_timer_cb(isc_task_t *task, isc_event_t *event) {
        REQUIRE(isc_nm_tid() >= 0);
        REQUIRE(DNS_RPZ_ZONE_VALID(rpz));
 
-       dns_rpz_ref_rpzs(rpz->rpzs);
-
        LOCK(&rpz->rpzs->maint_lock);
 
        if (rpz->rpzs->shuttingdown) {
@@ -1981,6 +1979,7 @@ dns__rpz_timer_cb(isc_task_t *task, isc_event_t *event) {
        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_nm_work_offload(isc_task_getnetmgr(rpz->rpzs->updater),
                            update_rpz_cb, update_rpz_done_cb, rpz);