summaryrefslogtreecommitdiffstats
path: root/security/security.c
diff options
context:
space:
mode:
Diffstat (limited to 'security/security.c')
-rw-r--r--security/security.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/security/security.c b/security/security.c
index 88de6b073246..a8dd7defe30a 100644
--- a/security/security.c
+++ b/security/security.c
@@ -49,6 +49,7 @@ static __initconst const char * const builtin_lsm_order = CONFIG_LSM;
49 49
50/* Ordered list of LSMs to initialize. */ 50/* Ordered list of LSMs to initialize. */
51static __initdata struct lsm_info **ordered_lsms; 51static __initdata struct lsm_info **ordered_lsms;
52static __initdata struct lsm_info *exclusive;
52 53
53static __initdata bool debug; 54static __initdata bool debug;
54#define init_debug(...) \ 55#define init_debug(...) \
@@ -129,6 +130,12 @@ static bool __init lsm_allowed(struct lsm_info *lsm)
129 if (!is_enabled(lsm)) 130 if (!is_enabled(lsm))
130 return false; 131 return false;
131 132
133 /* Not allowed if another exclusive LSM already initialized. */
134 if ((lsm->flags & LSM_FLAG_EXCLUSIVE) && exclusive) {
135 init_debug("exclusive disabled: %s\n", lsm->name);
136 return false;
137 }
138
132 return true; 139 return true;
133} 140}
134 141
@@ -144,6 +151,11 @@ static void __init maybe_initialize_lsm(struct lsm_info *lsm)
144 if (enabled) { 151 if (enabled) {
145 int ret; 152 int ret;
146 153
154 if ((lsm->flags & LSM_FLAG_EXCLUSIVE) && !exclusive) {
155 exclusive = lsm;
156 init_debug("exclusive chosen: %s\n", lsm->name);
157 }
158
147 init_debug("initializing %s\n", lsm->name); 159 init_debug("initializing %s\n", lsm->name);
148 ret = lsm->init(); 160 ret = lsm->init();
149 WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret); 161 WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret);