Move the kauth_init() call above auto-configuration; this will fix some
recent bugs introduced with the usage of kauth(9) in MD/device code. While here, change the sanity checks to KASSERT(), because they're really bugs we should fix if triggered.
This commit is contained in:
parent
e815c718be
commit
f0c7040a3f
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: init_main.c,v 1.277 2006/09/08 20:58:57 elad Exp $ */
|
||||
/* $NetBSD: init_main.c,v 1.278 2006/10/02 16:29:57 elad Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
|
||||
@ -71,7 +71,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.277 2006/09/08 20:58:57 elad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.278 2006/10/02 16:29:57 elad Exp $");
|
||||
|
||||
#include "opt_ipsec.h"
|
||||
#include "opt_kcont.h"
|
||||
@ -304,6 +304,9 @@ main(void)
|
||||
ntp_init();
|
||||
#endif /* __HAVE_TIMECOUNTER */
|
||||
|
||||
/* Initialize kauth. */
|
||||
kauth_init();
|
||||
|
||||
/* Configure the system hardware. This will enable interrupts. */
|
||||
configure();
|
||||
|
||||
@ -332,9 +335,6 @@ main(void)
|
||||
ksem_init();
|
||||
#endif
|
||||
|
||||
/* Initialize kauth. */
|
||||
kauth_init();
|
||||
|
||||
/* Initialize default security model. */
|
||||
secmodel_start();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: kern_auth.c,v 1.25 2006/09/30 20:05:57 elad Exp $ */
|
||||
/* $NetBSD: kern_auth.c,v 1.26 2006/10/02 16:29:57 elad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2005, 2006 Elad Efrat <elad@NetBSD.org>
|
||||
@ -36,7 +36,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.25 2006/09/30 20:05:57 elad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_auth.c,v 1.26 2006/10/02 16:29:57 elad Exp $");
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
@ -716,16 +716,15 @@ kauth_authorize_action(kauth_scope_t scope, kauth_cred_t cred,
|
||||
simple_lock_only_held(NULL, "kauth_authorize_action");
|
||||
#endif
|
||||
|
||||
/* Sanitize input */
|
||||
if (scope == NULL || cred == NULL)
|
||||
return (EFAULT);
|
||||
if (!action)
|
||||
return (EINVAL);
|
||||
KASSERT(cred != NULL);
|
||||
KASSERT(action != 0);
|
||||
|
||||
/* Short-circuit requests coming from the kernel. */
|
||||
if (cred == NOCRED || cred == FSCRED)
|
||||
return (0);
|
||||
|
||||
KASSERT(scope != NULL);
|
||||
|
||||
if (!listeners_have_been_loaded) {
|
||||
KASSERT(SIMPLEQ_EMPTY(&scope->listenq));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user