summaryrefslogtreecommitdiff
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorPaul Moore <paul@paul-moore.com>2016-11-29 16:53:23 -0500
committerPaul Moore <paul@paul-moore.com>2016-12-14 13:06:04 -0500
commit6c9255645350ce2aecb7c3cd032d0e93d4a7a71a (patch)
treef3720064aba7115b99aa42216dc2da55403ce47f /kernel/audit.c
parent55a6f170a413cd8dc7a3a52e5a326e1a87579b4f (diff)
downloadlwn-6c9255645350ce2aecb7c3cd032d0e93d4a7a71a.tar.gz
lwn-6c9255645350ce2aecb7c3cd032d0e93d4a7a71a.zip
audit: fixup audit_init()
Make sure everything is initialized before we start the kauditd_thread and don't emit the "initialized" record until everything is finished. We also panic with a descriptive message if we can't start the kauditd_thread. Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index d4c78ba5c4f9..b61642b1934f 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1180,21 +1180,23 @@ static int __init audit_init(void)
audit_default ? "enabled" : "disabled");
register_pernet_subsys(&audit_net_ops);
- kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd");
- if (IS_ERR(kauditd_task))
- return PTR_ERR(kauditd_task);
-
skb_queue_head_init(&audit_skb_queue);
skb_queue_head_init(&audit_skb_hold_queue);
audit_initialized = AUDIT_INITIALIZED;
audit_enabled = audit_default;
audit_ever_enabled |= !!audit_default;
- audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL, "initialized");
-
for (i = 0; i < AUDIT_INODE_BUCKETS; i++)
INIT_LIST_HEAD(&audit_inode_hash[i]);
+ kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd");
+ if (IS_ERR(kauditd_task)) {
+ int err = PTR_ERR(kauditd_task);
+ panic("audit: failed to start the kauditd thread (%d)\n", err);
+ }
+
+ audit_log(NULL, GFP_KERNEL, AUDIT_KERNEL, "initialized");
+
return 0;
}
__initcall(audit_init);