From 7d59a0ed813c9b30920e8b60f5579be6b0f4b845 Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Thu, 8 Feb 2024 19:35:29 -0800 Subject: [PATCH] prevent a possible race in setting up zone->xfr the call to dns_xfrin_create() wrote to zone->xfr with the zone unlocked. --- lib/dns/zone.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dns/zone.c b/lib/dns/zone.c index 9a9411dc6d..918c481e54 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -18152,6 +18152,7 @@ got_transfer_quota(void *arg) { const char *soa_before = ""; bool loaded; isc_tlsctx_cache_t *zmgr_tlsctx_cache = NULL; + dns_xfrin_t *xfr = NULL; if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) { zone_xfrdone(zone, NULL, ISC_R_CANCELED); @@ -18302,7 +18303,7 @@ got_transfer_quota(void *arg) { result = dns_xfrin_create(zone, xfrtype, &primaryaddr, &sourceaddr, zone->tsigkey, soa_transport_type, zone->transport, zmgr_tlsctx_cache, - zone->mctx, zone_xfrdone, &zone->xfr); + zone->mctx, zone_xfrdone, &xfr); isc_tlsctx_cache_detach(&zmgr_tlsctx_cache); @@ -18317,6 +18318,7 @@ got_transfer_quota(void *arg) { } LOCK_ZONE(zone); + zone->xfr = xfr; if (xfrtype == dns_rdatatype_axfr) { if (isc_sockaddr_pf(&primaryaddr) == PF_INET) { inc_stats(zone, dns_zonestatscounter_axfrreqv4);