git: 9383427b2f90 - stable/15 - MAC/do: Move hold_conf() and drop_conf() earlier
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 29 Jun 2026 19:25:43 UTC
The branch stable/15 has been updated by olce:
URL: https://cgit.FreeBSD.org/src/commit/?id=9383427b2f906dc39ac61a466afa642f3707f2f8
commit 9383427b2f906dc39ac61a466afa642f3707f2f8
Author: Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-04-27 12:55:05 +0000
Commit: Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-06-29 19:23:42 +0000
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
(cherry picked from commit cd1ac04409359ec1357e23752f20b22f5055ddfa)
---
sys/security/mac_do/mac_do.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c
index 0b224a24e0a7..e844cda7e1c4 100644
--- a/sys/security/mac_do/mac_do.c
+++ b/sys/security/mac_do/mac_do.c
@@ -1162,6 +1162,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.
*
@@ -1202,21 +1217,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)