aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Certner <olce@FreeBSD.org>2026-04-27 12:55:05 +0000
committerOlivier Certner <olce@FreeBSD.org>2026-05-29 15:22:01 +0000
commitcd1ac04409359ec1357e23752f20b22f5055ddfa (patch)
treec6d3d1e79ce1a87a008d0f7b01e2256a62c33f09
parentcf942ac9e967055286a7076bf76e9a62e1d22d8f (diff)
MAC/do: Move hold_conf() and drop_conf() earlier
This is in preparation for using hold_conf() in find_conf(). Reviewed by: bapt MFC after: 1 month Sponsored by: The FreeBSD Foundation Pull Request: https://ron-dev.freebsd.org/FreeBSD/src/pulls/38
-rw-r--r--sys/security/mac_do/mac_do.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c
index 3d0ce2b49baa..cb351cef15ce 100644
--- a/sys/security/mac_do/mac_do.c
+++ b/sys/security/mac_do/mac_do.c
@@ -1160,6 +1160,21 @@ error:
goto out;
}
+static void
+hold_conf(struct conf *const conf)
+{
+ refcount_acquire(&conf->use_count);
+}
+
+static void
+drop_conf(struct conf *const conf)
+{
+ if (refcount_release(&conf->use_count)) {
+ toast_rules(&conf->rules);
+ free(conf, M_MAC_DO);
+ }
+}
+
/*
* Find configuration applicable to the passed prison.
*
@@ -1200,21 +1215,6 @@ find_conf(struct prison *const pr, struct prison **const aprp)
return (conf);
}
-static void
-hold_conf(struct conf *const conf)
-{
- refcount_acquire(&conf->use_count);
-}
-
-static void
-drop_conf(struct conf *const conf)
-{
- if (refcount_release(&conf->use_count)) {
- toast_rules(&conf->rules);
- free(conf, M_MAC_DO);
- }
-}
-
#ifdef INVARIANTS
static void
check_conf_use_count(const struct conf *const conf, u_int expected)