audit: print error message when fail to create audit socket
authorGao feng <gaofeng@cn.fujitsu.com>
Tue, 17 Dec 2013 03:10:41 +0000 (11:10 +0800)
committerEric Paris <eparis@redhat.com>
Tue, 14 Jan 2014 03:32:44 +0000 (22:32 -0500)
print the error message and then return -ENOMEM.

Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
kernel/audit.c

index 15661ef..b27b706 100644 (file)
@@ -1082,12 +1082,11 @@ static int __net_init audit_net_init(struct net *net)
        pr_info("audit: initializing netlink socket in namespace\n");
 
        aunet->nlsk = netlink_kernel_create(net, NETLINK_AUDIT, &cfg);
-       if (aunet->nlsk == NULL)
-               return -ENOMEM;
-       if (!aunet->nlsk)
+       if (aunet->nlsk == NULL) {
                audit_panic("cannot initialize netlink socket in namespace");
-       else
-               aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
+               return -ENOMEM;
+       }
+       aunet->nlsk->sk_sndtimeo = MAX_SCHEDULE_TIMEOUT;
        return 0;
 }