summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorXiaoke Wang <xkernel.wang@foxmail.com>2022-01-15 09:11:11 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-16 12:43:52 +0100
commit9d75b8889739721b59c5731a68c06e7683e8360b (patch)
treebd517b252c90cde7296646fe961d6eabe37bf061 /security
parentad3dfaf3e83818c54d1d2637ab818a4b00f8baf7 (diff)
downloadlinux-9d75b8889739721b59c5731a68c06e7683e8360b.tar.gz
linux-9d75b8889739721b59c5731a68c06e7683e8360b.tar.bz2
linux-9d75b8889739721b59c5731a68c06e7683e8360b.zip
integrity: check the return value of audit_log_start()
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: 3323eec921ef ("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>
Diffstat (limited to 'security')
-rw-r--r--security/integrity/integrity_audit.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
index 90987d15b6fe..6c415667ba67 100644
--- a/security/integrity/integrity_audit.c
+++ b/security/integrity/integrity_audit.c
@@ -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),