Skip to content

Commit

Permalink
integrity: check the return value of audit_log_start()
Browse files Browse the repository at this point in the history
commit 83230351c523b04ff8a029a4bdf97d881ecb96fc upstream.

audit_log_start() returns audit_buffer pointer on success or NULL on
error, so it is better to check the return value of it.

Fixes: 3323eec ("integrity: IMA as an integrity service provider")
Signed-off-by: Xiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
x2018 authored and pavelmachek committed Mar 17, 2022
1 parent 6d46b2a commit 3b040cd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security/integrity/integrity_audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ void integrity_audit_msg(int audit_msgno, struct inode *inode,
return;

ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
if (!ab)
return;
audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u",
task_pid_nr(current),
from_kuid(&init_user_ns, current_cred()->uid),
Expand Down

0 comments on commit 3b040cd

Please sign in to comment.