From 79ee7353ad5eda781c4f9d2297ddff32682731d6 Mon Sep 17 00:00:00 2001
From: Aram Sargsyan <aram@isc.org>
Date: Fri, 27 Jan 2023 18:04:41 +0000
Subject: [PATCH] Searching catzs->zones requires a read lock

Lock the catzs->lock mutex before searching in the catzs->zones
hash table.

Conflict: NA
Reference: https://gitlab.isc.org/isc-projects/bind9/-/commit/79ee7353ad5eda781c4f9d2297ddff32682731d6

(cherry picked from commit 0ef0c86632c838c3f342fe1c6d8cdef1b327cde6)
---
 lib/dns/catz.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/dns/catz.c b/lib/dns/catz.c
index 9a9ecd0dc9..eef688a1d0 100644
--- a/lib/dns/catz.c
+++ b/lib/dns/catz.c
@@ -752,8 +752,10 @@ dns_catz_get_zone(dns_catz_zones_t *catzs, const dns_name_t *name) {
 	REQUIRE(DNS_CATZ_ZONES_VALID(catzs));
 	REQUIRE(ISC_MAGIC_VALID(name, DNS_NAME_MAGIC));
 
+	LOCK(&catzs->lock);
 	result = isc_ht_find(catzs->zones, name->ndata, name->length,
 			     (void **)&found);
+	UNLOCK(&catzs->lock);
 	if (result != ISC_R_SUCCESS) {
 		return (NULL);
 	}
-- 
2.23.0
