From 143d1c9767e25d35dd939f43f6bae462ee9db477 Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Thu, 27 Feb 2020 11:59:12 +0100 Subject: [PATCH] Add more zone locks Add more zone locks around code that touches zone timer setting in failure modes. --- lib/dns/zone.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index c07dfb1298..7f4975240b 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -7167,12 +7167,12 @@ failure: } else if (db != NULL) { dns_db_detach(&db); } + + LOCK_ZONE(zone); if (result == ISC_R_SUCCESS) { - LOCK_ZONE(zone); set_resigntime(zone); zone_needdump(zone, DNS_DUMP_DELAY); DNS_ZONE_SETFLAG(zone, DNS_ZONEFLG_NEEDNOTIFY); - UNLOCK_ZONE(zone); } else { /* * Something failed. Retry in 5 minutes. @@ -7181,6 +7181,7 @@ failure: isc_interval_set(&ival, 300, 0); isc_time_nowplusinterval(&zone->resigntime, &ival); } + UNLOCK_ZONE(zone); INSIST(version == NULL); } @@ -9679,6 +9680,7 @@ cleanup: dns_db_detach(&db); } + LOCK_ZONE(zone); if (ISC_LIST_HEAD(zone->signing) != NULL) { isc_interval_t interval; if (zone->update_disabled || result != ISC_R_SUCCESS) { @@ -9690,6 +9692,7 @@ cleanup: } else { isc_time_settoepoch(&zone->signingtime); } + UNLOCK_ZONE(zone); INSIST(version == NULL); } @@ -19692,6 +19695,7 @@ zone_rekey(dns_zone_t *zone) { result = ISC_R_SUCCESS; failure: + LOCK_ZONE(zone); if (result != ISC_R_SUCCESS) { /* * Something went wrong; try again in ten minutes or @@ -19701,6 +19705,7 @@ failure: 0); isc_time_nowplusinterval(&zone->refreshkeytime, &ival); } + UNLOCK_ZONE(zone); dns_diff_clear(&diff); dns_diff_clear(&_sig_diff);