LSM: Don't ignore initialization failures
authorKees Cook <keescook@chromium.org>
Thu, 11 Oct 2018 00:18:26 +0000 (17:18 -0700)
committerJames Morris <james.morris@microsoft.com>
Thu, 11 Oct 2018 03:40:22 +0000 (20:40 -0700)
LSM initialization failures have traditionally been ignored. We should
at least WARN when something goes wrong.

Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Casey Schaufler <casey@schaufler-ca.com>
Reviewed-by: John Johansen <john.johansen@canonical.com>
Signed-off-by: James Morris <james.morris@microsoft.com>
security/security.c

index 395f804f6a9171ad0e5f7ea95c38b5b9e95f1987..2055af907eba29469c602da8f6349ef9d1ae8ab5 100644 (file)
@@ -55,10 +55,12 @@ static __initdata bool debug;
 static void __init major_lsm_init(void)
 {
        struct lsm_info *lsm;
+       int ret;
 
        for (lsm = __start_lsm_info; lsm < __end_lsm_info; lsm++) {
                init_debug("initializing %s\n", lsm->name);
-               lsm->init();
+               ret = lsm->init();
+               WARN(ret, "%s failed to initialize: %d\n", lsm->name, ret);
        }
 }