diff options
author | mvs <mvs@cvs.openbsd.org> | 2021-02-11 20:28:02 +0000 |
---|---|---|
committer | mvs <mvs@cvs.openbsd.org> | 2021-02-11 20:28:02 +0000 |
commit | 831ad35c503a137b0cb45741663c2ee30956f887 (patch) | |
tree | 6e66152b04a089273b4592d70c5912e4227ed433 /sys | |
parent | 8a6508d2a3ae7eefda438c34566b24ef1ce7fe5d (diff) |
We link `ifp' to `if_list' before we perform if_attachsetup(). It is not
fully initialized because we initialize `if_groups' after linking. It's
not triggered because if_attach() and if_unit(9) are serialized by
kernel lock and `ifp' is often filled by nulls. Move `if_groups'
initialization to if_attach_common() to prevent this.
ok bluhm@ claudio@ deraadt@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sys/net/if.c b/sys/net/if.c index e9c29506b4c..32e6cf05f9a 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.628 2021/02/10 14:41:53 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.629 2021/02/11 20:28:01 mvs Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -423,8 +423,6 @@ if_attachsetup(struct ifnet *ifp) NET_ASSERT_LOCKED(); - TAILQ_INIT(&ifp->if_groups); - if_addgroup(ifp, IFG_ALL); if_attachdomain(ifp); @@ -596,6 +594,7 @@ if_attach_common(struct ifnet *ifp) TAILQ_INIT(&ifp->if_addrlist); TAILQ_INIT(&ifp->if_maddrlist); + TAILQ_INIT(&ifp->if_groups); if (!ISSET(ifp->if_xflags, IFXF_MPSAFE)) { KASSERTMSG(ifp->if_qstart == NULL, |