]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
fs: handle failed audit_log_start properly
authorSasha Levin <sasha.levin@oracle.com>
Thu, 4 Oct 2012 23:57:31 +0000 (19:57 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Oct 2012 16:32:42 +0000 (09:32 -0700)
commit d1c7d97ad58836affde6e39980b96527510b572e upstream.

audit_log_start() may return NULL, this is unchecked by the caller in
audit_log_link_denied() and could cause a NULL ptr deref.

Introduced by commit a51d9eaa ("fs: add link restriction audit reporting").

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Dave Jones <davej@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/audit.c

index ea3b7b6191c7af3347dce055a88af200c55d1f5d..a8c84be9b9ea0ca5677852e6ea160325086bba12 100644 (file)
@@ -1466,6 +1466,8 @@ void audit_log_link_denied(const char *operation, struct path *link)
 
        ab = audit_log_start(current->audit_context, GFP_KERNEL,
                             AUDIT_ANOM_LINK);
+       if (!ab)
+               return;
        audit_log_format(ab, "op=%s action=denied", operation);
        audit_log_format(ab, " pid=%d comm=", current->pid);
        audit_log_untrustedstring(ab, current->comm);