audit: make ANOM_LINK obey audit_enabled and audit_dummy_context
authorRichard Guy Briggs <rgb@redhat.com>
Wed, 14 Feb 2018 16:18:21 +0000 (11:18 -0500)
committerPaul Moore <paul@paul-moore.com>
Fri, 9 Mar 2018 00:19:54 +0000 (19:19 -0500)
Audit link denied events emit disjointed records when audit is disabled.
No records should be emitted when audit is disabled.

See: https://github.com/linux-audit/audit-kernel/issues/21

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
kernel/audit.c

index 69ef8de69f0378d49ed8ee4834ff18552f9a7fab..46cd8f66af170ce66df61fb66ff1d59055e1298f 100644 (file)
@@ -2315,6 +2315,9 @@ void audit_log_link_denied(const char *operation, const struct path *link)
        struct audit_buffer *ab;
        struct audit_names *name;
 
+       if (!audit_enabled || audit_dummy_context())
+               return;
+
        name = kzalloc(sizeof(*name), GFP_NOFS);
        if (!name)
                return;