[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHC9VhQDEG7hOwAzTCkaiO7r7sgaV2B08BVV6V3XMVLZztcS+g@mail.gmail.com>
Date: Fri, 14 Jan 2022 17:13:02 -0500
From: Paul Moore <paul@...l-moore.com>
To: xkernel.wang@...mail.com
Cc: jmorris@...ei.org, serge@...lyn.com,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCHv2] integrity: check the return value of audit_log_start()
On Thu, Jan 13, 2022 at 11:24 PM <xkernel.wang@...mail.com> wrote:
>
> From: Xiaoke Wang <xkernel.wang@...mail.com>
>
> audit_log_start() returns audit_buffer pointer on success or NULL on
> error, so it is better to check the return value of it.
>
> Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
Reviewed-by: Paul Moore <paul@...l-moore.com>
> ---
> Changelogs: simplify the patch.
> Note: Take the suggestion from Paul Moore.
> security/integrity/integrity_audit.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> 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()),
> --
--
paul moore
www.paul-moore.com
Powered by blists - more mailing lists