]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
audit: move kaudit thread start from auditd registration to kaudit init
authorRichard Guy Briggs <rgb@redhat.com>
Thu, 24 Jan 2013 18:15:12 +0000 (13:15 -0500)
committerEric Paris <eparis@redhat.com>
Mon, 8 Apr 2013 20:19:18 +0000 (16:19 -0400)
The kauditd_thread() task was started only after the auditd userspace daemon
registers itself with kaudit.  This was fine when only auditd consumed messages
from the kaudit netlink unicast socket.  With the addition of a multicast group
to that socket it is more convenient to have the thread start on init of the
kaudit kernel subsystem.

Signed-off-by: Richard Guy Briggs <rbriggs@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
kernel/audit.c

index 1531efbd11e2fe645b4a9c14898487caca914675..02a5d9eefa823436050d4ed59a624138a3de61cf 100644 (file)
@@ -676,16 +676,6 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
        if (err)
                return err;
 
-       /* As soon as there's any sign of userspace auditd,
-        * start kauditd to talk to it */
-       if (!kauditd_task)
-               kauditd_task = kthread_run(kauditd_thread, NULL, "kauditd");
-       if (IS_ERR(kauditd_task)) {
-               err = PTR_ERR(kauditd_task);
-               kauditd_task = NULL;
-               return err;
-       }
-
        loginuid = audit_get_loginuid(current);
        sessionid = audit_get_sessionid(current);
        security_task_getsecid(current, &sid);
@@ -974,6 +964,10 @@ static int __init audit_init(void)
        else
                audit_sock->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
 
+       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;