From: Michał Kępień Date: Tue, 14 Jun 2022 11:13:32 +0000 (+0200) Subject: Adjust recursion quota when starting a fetch fails X-Git-Tag: v9.19.3~47^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e09b36f2ccad77d78cba6435a26b49884a8dcdea;p=thirdparty%2Fbind9.git Adjust recursion quota when starting a fetch fails Some functions fail to detach from the recursion quota if an error occurs while initiating recursion. This causes the recursive client counter to be off. Add missing recursionquota_detach() calls, reworking cleanup code where appropriate. --- diff --git a/lib/ns/query.c b/lib/ns/query.c index f1f004a6848..529e8b03f34 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -2618,6 +2618,7 @@ fetch_and_forget(ns_client_t *client, dns_name_t *qname, dns_rdatatype_t qtype, if (result != ISC_R_SUCCESS) { ns_client_putrdataset(client, &tmprdataset); isc_nmhandle_detach(handlep); + recursionquotatype_detach(client, recursion_type); } } @@ -6464,6 +6465,7 @@ ns_query_recurse(ns_client_t *client, dns_rdatatype_t qtype, dns_name_t *qname, if (sigrdataset != NULL) { ns_client_putrdataset(client, &sigrdataset); } + recursionquotatype_detach(client, RECTYPE_NORMAL); } /* @@ -6833,7 +6835,7 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync, client->manager->task, query_hookresume, client, &client->query.hookactx); if (result != ISC_R_SUCCESS) { - goto cleanup; + goto cleanup_and_detach_from_quota; } /* @@ -6850,6 +6852,8 @@ ns_query_hookasync(query_ctx_t *qctx, ns_query_starthookasync_t runasync, isc_nmhandle_attach(client->handle, &HANDLE_RECTYPE_HOOK(client)); return (ISC_R_SUCCESS); +cleanup_and_detach_from_quota: + recursionquotatype_detach(client, RECTYPE_HOOK); cleanup: /* * If we fail, send SERVFAIL now. It may be better to let the caller