Skip to content

Commit

Permalink
fs: handle failed audit_log_start properly
Browse files Browse the repository at this point in the history
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 a51d9ea ("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>
  • Loading branch information
sashalevin authored and Al Viro committed Oct 10, 2012
1 parent ffd8d10 commit d1c7d97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/audit.c
Expand Up @@ -1440,6 +1440,8 @@ void audit_log_link_denied(const char *operation, struct path *link)


ab = audit_log_start(current->audit_context, GFP_KERNEL, ab = audit_log_start(current->audit_context, GFP_KERNEL,
AUDIT_ANOM_LINK); AUDIT_ANOM_LINK);
if (!ab)
return;
audit_log_format(ab, "op=%s action=denied", operation); audit_log_format(ab, "op=%s action=denied", operation);
audit_log_format(ab, " pid=%d comm=", current->pid); audit_log_format(ab, " pid=%d comm=", current->pid);
audit_log_untrustedstring(ab, current->comm); audit_log_untrustedstring(ab, current->comm);
Expand Down

0 comments on commit d1c7d97

Please sign in to comment.