]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix the statistic counter underflow in ns_client_t
authorOndřej Surý <ondrej@sury.org>
Thu, 26 Mar 2020 09:57:38 +0000 (10:57 +0100)
committerOndřej Surý <ondrej@isc.org>
Fri, 3 Apr 2020 17:41:46 +0000 (19:41 +0200)
commit78886d4bedeef3dcffa1f9eebe431f35a03f3593
treeaeb0b38d913106f1fb73943938a6d2884484611c
parent26842ac25cd56b461733e558c17682622c525e3c
Fix the statistic counter underflow in ns_client_t

In case of normal fetch, the .recursionquota is attached and
ns_statscounter_recursclients is incremented when the fetch is created.  Then
the .recursionquota is detached and the counter decremented in the
fetch_callback().

In case of prefetch or rpzfetch, the quota is attached, but the counter is not
incremented.  When we reach the soft-quota, the function returns early but don't
detach from the quota, and it gets destroyed during the ns_client_endrequest(),
so no memory was leaked.

But because the ns_statscounter_recursclients is only incremented during the
normal fetch the counter would be incorrectly decremented on two occassions:

1) When we reached the softquota, because the quota was not properly detached
2) When the prefetch or rpzfetch was cancelled mid-flight and the callback
   function was never called.
lib/ns/client.c
lib/ns/query.c