[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <e6f00d74a9d5b4e05e2229984bb56f02e7523c0f.camel@linux.ibm.com>
Date: Mon, 17 Jan 2022 17:58:09 -0500
From: Mimi Zohar <zohar@...ux.ibm.com>
To: Paul Moore <paul@...l-moore.com>, xkernel.wang@...mail.com
Cc: jmorris@...ei.org, serge@...lyn.com,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] integrity: check the return value of audit_log_start()
On Wed, 2022-01-12 at 12:23 -0500, Paul Moore wrote:
> On Tue, Dec 14, 2021 at 12:39 AM <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 to prevent
> > potential memory access error.
> >
> > Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
> > ---
> > security/integrity/integrity_audit.c | 38 +++++++++++++++-------------
> > 1 file changed, 20 insertions(+), 18 deletions(-)
> >
> > diff --git a/security/integrity/integrity_audit.c b/security/integrity/integrity_audit.c
> > index 2922005..62785d5 100644
> > --- a/security/integrity/integrity_audit.c
> > +++ b/security/integrity/integrity_audit.c
> > @@ -45,23 +45,25 @@ void integrity_audit_message(int audit_msgno, struct inode *inode,
> > return;
> >
> > ab = audit_log_start(audit_context(), GFP_KERNEL, audit_msgno);
>
> As this is IMA code, it's largely up to Mimi about what she would
> prefer, but I think a much simpler patch would be to just return early
> if ab == NULL, for example:
>
> ab = audit_log_start( .... , audit_msgno);
> if (!ab)
> return;
Thanks, Paul. Neither the linux-integrity mailing list nor I were
Cc'ed on this. Looks like the IMA & EVM records in MAINTAINERS should
be updated to include the security/integrity directory.
thanks,
Mimi
Powered by blists - more mailing lists