]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use ns_g_server->recursionquota instead of client->recursionquota
authorMark Andrews <marka@isc.org>
Wed, 9 Sep 2020 05:49:11 +0000 (15:49 +1000)
committerMark Andrews <marka@isc.org>
Wed, 9 Sep 2020 06:01:54 +0000 (06:01 +0000)
as the later will be NULL on ISC_R_QUOTA.

*** CID 306732:  Null pointer dereferences  (FORWARD_NULL)
/bin/named/query.c: 4359 in query_recurse()
4353      static _Atomic(isc_stdtime_t) last = 0;
4354     #else
4355      static isc_stdtime_t last = 0;
4356     #endif
4357      isc_stdtime_t now;
4358      isc_stdtime_get(&now);
   CID 306732:  Null pointer dereferences  (FORWARD_NULL)
   Passing "client" to "log_quota", which dereferences null "client->recursionquota".
4359      log_quota(client, &last, now,
4360        "no more recursive clients (%d/%d/%d): %s",
4361        isc_result_totext(result));
4362      ns_client_killoldestquery(client);
4363      }
4364      if (result == ISC_R_SUCCESS && !client->mortal &&

** CID 306731:  Program hangs  (LOCK)
/lib/dns/resolver.c: 8943 in spillattimer_countdown()

bin/named/query.c

index aaed6194e5cba68f91e4e9c5b086582a2d52f405..3390af2a4ec3a2300135da4710448cf97888cb6c 100644 (file)
@@ -4291,15 +4291,15 @@ log_quota(ns_client_t *client, isc_stdtime_t *last, isc_stdtime_t now,
        isc_stdtime_t old = last_load(last);
        if (now > old || (old + 1) > now) {
                if (last_cmpxchg(last, &old, now)) {
-                       LOCK(&client->recursionquota->lock);
+                       LOCK(&ns_g_server->recursionquota.lock);
                        ns_client_log(client, NS_LOGCATEGORY_CLIENT,
                                              NS_LOGMODULE_QUERY,
                                              ISC_LOG_WARNING, fmt,
-                                             client->recursionquota->used,
-                                             client->recursionquota->soft,
-                                             client->recursionquota->max,
+                                             ns_g_server->recursionquota.used,
+                                             ns_g_server->recursionquota.soft,
+                                             ns_g_server->recursionquota.max,
                                              tail);
-                       UNLOCK(&client->recursionquota->lock);
+                       UNLOCK(&ns_g_server->recursionquota.lock);
                }
        }
 }