]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
prevent a possible race in setting up zone->xfr
authorEvan Hunt <each@isc.org>
Fri, 9 Feb 2024 03:35:29 +0000 (19:35 -0800)
committerEvan Hunt <each@isc.org>
Wed, 14 Feb 2024 18:53:17 +0000 (18:53 +0000)
the call to dns_xfrin_create() wrote to zone->xfr with
the zone unlocked.

lib/dns/zone.c

index 9a9411dc6d38fc9ae1f6aa7ca7a8ba3f382386fd..918c481e5486f6042b18edccc8cc88bd6129eaa8 100644 (file)
@@ -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);