linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Paul Moore <paul@paul-moore.com>, xkernel.wang@foxmail.com
Cc: jmorris@namei.org, serge@hallyn.com,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] integrity: check the return value of audit_log_start()
Date: Mon, 17 Jan 2022 17:58:09 -0500	[thread overview]
Message-ID: <e6f00d74a9d5b4e05e2229984bb56f02e7523c0f.camel@linux.ibm.com> (raw)
In-Reply-To: <CAHC9VhT018QQmjYdh1ftOYrMC9ZxMqKtkBU2dceF=PLg2j6rvQ@mail.gmail.com>

On Wed, 2022-01-12 at 12:23 -0500, Paul Moore wrote:
> On Tue, Dec 14, 2021 at 12:39 AM <xkernel.wang@foxmail.com> wrote:
> >
> > From: Xiaoke Wang <xkernel.wang@foxmail.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@foxmail.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


      reply	other threads:[~2022-01-17 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-14  3:34 [PATCH] integrity: check the return value of audit_log_start() xkernel.wang
2022-01-12 17:23 ` Paul Moore
2022-01-17 22:58   ` Mimi Zohar [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e6f00d74a9d5b4e05e2229984bb56f02e7523c0f.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=jmorris@namei.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=xkernel.wang@foxmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).