]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
when creating an interface, set magic before linking
authorEvan Hunt <each@isc.org>
Wed, 7 Sep 2022 00:12:14 +0000 (17:12 -0700)
committerEvan Hunt <each@isc.org>
Wed, 7 Sep 2022 04:48:28 +0000 (21:48 -0700)
set the magic number in a newly-created interface object
before appending it to mgr->interfaces in order to prevent
a possible assertion.

(cherry picked from commit 8c01662048bbdb36c671c210183d7eecedd69e05)

lib/ns/interfacemgr.c

index 1bd684126f9d29ec2a742743c64ddae84358a3b8..d02493244ec6f61083a2314b991c966efd2f22f8 100644 (file)
@@ -477,12 +477,12 @@ interface_create(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr, const char *name,
        ISC_LINK_INIT(ifp, link);
 
        ns_interfacemgr_attach(mgr, &ifp->mgr);
+       ifp->magic = IFACE_MAGIC;
+
        LOCK(&mgr->lock);
        ISC_LIST_APPEND(mgr->interfaces, ifp, link);
        UNLOCK(&mgr->lock);
 
-       ifp->magic = IFACE_MAGIC;
-
        *ifpret = ifp;
 }