From acfca3f4fa6c22f28a2178de0eca30a9d8a0763f Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Tue, 6 Sep 2022 17:12:14 -0700 Subject: [PATCH] when creating an interface, set magic before linking 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ns/interfacemgr.c b/lib/ns/interfacemgr.c index 1bd684126f..d02493244e 100644 --- a/lib/ns/interfacemgr.c +++ b/lib/ns/interfacemgr.c @@ -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; }