Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src-draft/trunk]: src/sys/net80211 Make sure to initialize ic_list_mtx even ...



details:   https://anonhg.NetBSD.org/src-all/rev/2dc76cec7f2c
branches:  trunk
changeset: 361056:2dc76cec7f2c
user:      Martin Husemann <martin%NetBSD.org@localhost>
date:      Sun Oct 17 11:40:17 2021 +0200

description:
Make sure to initialize ic_list_mtx even w/o any wifi drivers attached

diffstat:

 sys/net80211/ieee80211.c |  23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diffs (55 lines):

diff -r 451346b79fa6 -r 2dc76cec7f2c sys/net80211/ieee80211.c
--- a/sys/net80211/ieee80211.c  Sun Oct 17 11:29:26 2021 +0200
+++ b/sys/net80211/ieee80211.c  Sun Oct 17 11:40:17 2021 +0200
@@ -320,6 +320,14 @@
 MTX_SYSINIT(ic_list, &ic_list_mtx, "ieee80211com list", MTX_DEF);
 #elif __NetBSD__
 static kmutex_t ic_list_mtx;
+static int
+ic_list_mtx_init (void)
+{
+       mutex_init(&ic_list_mtx, MUTEX_DEFAULT, IPL_NET);
+       ieee80211_auth_setup();
+       return 0;
+}
+static ONCE_DECL(ic_list_mtx_once);
 #endif
 
 #if defined(__FreeBSD__)
@@ -360,6 +368,7 @@
        const char *sp = "";
        int error, len, cnt = 0;
 
+       RUN_ONCE(&ic_list_mtx_once, ic_list_mtx_init);
        sb = sbuf_new_auto();
        mtx_lock(&ic_list_mtx);
        LIST_FOREACH(ic, &ic_head, ic_next) {
@@ -381,16 +390,6 @@
 }
 #endif
 
-#if __NetBSD__
-static int
-ic_list_mtx_init (void)
-{
-       mutex_init(&ic_list_mtx, MUTEX_DEFAULT, IPL_NET);
-       ieee80211_auth_setup();
-       return 0;
-}
-#endif
-
 /*
  * Attach/setup the common net80211 state.  Called by
  * the driver on attach to prior to creating any vap's.
@@ -399,9 +398,9 @@
 ieee80211_ifattach(struct ieee80211com *ic)
 {
 #if __NetBSD__
-       static ONCE_DECL(ic_list_mtx_once);
+       static ONCE_DECL(clone_init_once);
+
        RUN_ONCE(&ic_list_mtx_once, ic_list_mtx_init);
-       static ONCE_DECL(clone_init_once);
        RUN_ONCE(&clone_init_once, ieee80211_clone_attach);
 #endif
 



Home | Main Index | Thread Index | Old Index