summaryrefslogtreecommitdiff
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorSasha Levin <sasha.levin@oracle.com>2012-10-04 19:57:31 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-09 23:33:37 -0400
commitd1c7d97ad58836affde6e39980b96527510b572e (patch)
tree4020ac7f88154d5dd919fdf371472ea9153a656e /kernel/audit.c
parentffd8d101a3a7d3f2e79deee1e342801703b6dc70 (diff)
downloadlwn-d1c7d97ad58836affde6e39980b96527510b572e.tar.gz
lwn-d1c7d97ad58836affde6e39980b96527510b572e.zip
fs: handle failed audit_log_start properly
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>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index 4d0ceede3319..40414e9143db 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1440,6 +1440,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);