From owner-p4-projects@FreeBSD.ORG Mon Dec 6 06:18:54 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8ADC816A4D1; Mon, 6 Dec 2004 06:18:53 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3902816A4CE for ; Mon, 6 Dec 2004 06:18:53 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0952943D73 for ; Mon, 6 Dec 2004 06:18:53 +0000 (GMT) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id iB66Iqcn052564 for ; Mon, 6 Dec 2004 06:18:52 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id iB66IqTg052561 for perforce@freebsd.org; Mon, 6 Dec 2004 06:18:52 GMT (envelope-from sam@freebsd.org) Date: Mon, 6 Dec 2004 06:18:52 GMT Message-Id: <200412060618.iB66IqTg052561@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Subject: PERFORCE change 66517 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Dec 2004 06:18:54 -0000 http://perforce.freebsd.org/chv.cgi?CH=66517 Change 66517 by sam@sam_ebb on 2004/12/06 06:17:59 o add os-specific wrapper for loading modules o acquire Giant around call to linker_load_module now that ioctl doesn't grab it for us; this generates LOR's big time (as does holding the softc lock over the blocking mallocs) Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_crypto.c#5 edit .. //depot/projects/wifi/sys/net80211/ieee80211_freebsd.c#7 edit .. //depot/projects/wifi/sys/net80211/ieee80211_freebsd.h#9 edit .. //depot/projects/wifi/sys/net80211/ieee80211_proto.c#15 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto.c#5 (text+ko) ==== @@ -38,7 +38,6 @@ */ #include #include -#include #include @@ -249,9 +248,7 @@ IEEE80211_DPRINTF(ic, IEEE80211_MSG_CRYPTO, "%s: unregistered cipher %u, load module %s\n", __func__, cipher, cipher_modnames[cipher]); - /* XXX check return */ - linker_load_module(cipher_modnames[cipher], NULL, - NULL, NULL, NULL); + ieee80211_load_module(cipher_modnames[cipher]); /* * If cipher module loaded it should immediately * call ieee80211_crypto_register which will fill ==== //depot/projects/wifi/sys/net80211/ieee80211_freebsd.c#7 (text+ko) ==== @@ -34,8 +34,10 @@ #include #include #include +#include #include #include +#include #include #include @@ -295,6 +297,18 @@ } } +void +ieee80211_load_module(const char *modname) +{ + struct thread *td = curthread; + + if (suser(td) == 0 && securelevel_gt(td->td_ucred, 0) == 0) { + mtx_lock(&Giant); + (void) linker_load_module(modname, NULL, NULL, NULL, NULL); + mtx_unlock(&Giant); + } +} + /* * Module glue. * ==== //depot/projects/wifi/sys/net80211/ieee80211_freebsd.h#9 (text+ko) ==== @@ -179,6 +179,8 @@ void ieee80211_sysctl_attach(struct ieee80211com *); void ieee80211_sysctl_detach(struct ieee80211com *); +void ieee80211_load_module(const char *); + /* XXX this stuff belongs elsewhere */ /* * Message formats for messages from the net80211 layer to user ==== //depot/projects/wifi/sys/net80211/ieee80211_proto.c#15 (text+ko) ==== @@ -42,7 +42,6 @@ #include #include #include -#include #include @@ -181,10 +180,8 @@ { if (auth >= IEEE80211_AUTH_MAX) return NULL; - if (authenticators[auth] == NULL) { - /* XXX check return */ - linker_load_module(auth_modnames[auth], NULL, NULL, NULL, NULL); - } + if (authenticators[auth] == NULL) + ieee80211_load_module(auth_modnames[auth]); return authenticators[auth]; } @@ -231,7 +228,7 @@ ieee80211_aclator_get(const char *name) { if (acl == NULL) - linker_load_module("wlan_acl", NULL, NULL, NULL, NULL); + ieee80211_load_module("wlan_acl"); return acl != NULL && strcmp(acl->iac_name, name) == 0 ? acl : NULL; }