提交 2df92ede 编写于 作者: X Xiaoke Wang 提交者: Zheng Zengkai

integrity: check the return value of audit_log_start()

stable inclusion
from stable-v5.10.101
commit 7fea2e52000357abe4c2db94e177b72f02b5597f
bugzilla: https://gitee.com/openeuler/kernel/issues/I5669Z

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=7fea2e52000357abe4c2db94e177b72f02b5597f

--------------------------------

commit 83230351 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: 3323eec9 ("integrity: IMA as an integrity service provider")
Signed-off-by: NXiaoke Wang <xkernel.wang@foxmail.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: NPaul Moore <paul@paul-moore.com>
Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYu Liao <liaoyu15@huawei.com>
Reviewed-by: NWei Li <liwei391@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b9703254
...@@ -45,6 +45,8 @@ void integrity_audit_message(int audit_msgno, struct inode *inode, ...@@ -45,6 +45,8 @@ void integrity_audit_message(int audit_msgno, struct inode *inode,
return; return;
ab = audit_log_start(audit_context(), GFP_KERNEL, audit_msgno); ab = audit_log_start(audit_context(), GFP_KERNEL, audit_msgno);
if (!ab)
return;
audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u", audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u",
task_pid_nr(current), task_pid_nr(current),
from_kuid(&init_user_ns, current_uid()), from_kuid(&init_user_ns, current_uid()),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册