From: Xiaoke Wang Date: Sat, 15 Jan 2022 01:11:11 +0000 (+0800) Subject: integrity: check the return value of audit_log_start() X-Git-Tag: accepted/tizen/unified/20230118.172025~2532 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=739b7bb886b5ffa40a9492398aa04b01438e598b;p=platform%2Fkernel%2Flinux-rpi.git 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 Cc: Reviewed-by: Paul Moore Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman --- diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c index 2922005..0ec5e4c 100644 --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c @@ -45,6 +45,8 @@ void integrity_audit_message(int audit_msgno, struct inode *inode, return; 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", task_pid_nr(current), from_kuid(&init_user_ns, current_uid()),