linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KP Singh <kpsingh@chromium.org>
To: Linux Security Module list <linux-security-module@vger.kernel.org>
Subject: Re: [PATCH v2] ima: Fix NULL pointer dereference in ima_file_hash
Date: Wed, 16 Sep 2020 15:36:06 +0200	[thread overview]
Message-ID: <CACYkzJ45nu=WZeQ0uwL+QxsCxhgkvSmXtme08q60GG_M0rzW8A@mail.gmail.com> (raw)
In-Reply-To: <20200916124931.1254990-1-kpsingh@chromium.org>

On Wed, Sep 16, 2020 at 2:49 PM KP Singh <kpsingh@chromium.org> wrote:
>
> From: KP Singh <kpsingh@google.com>

[...]

Another attempt to get this on the lists.

> diff --git a/security/integrity/ima/ima_main.c b/security/integrity/ima/ima_main.c
> index 8a91711ca79b..4c86cd4eece0 100644
> --- a/security/integrity/ima/ima_main.c
> +++ b/security/integrity/ima/ima_main.c
> @@ -531,6 +531,16 @@ int ima_file_hash(struct file *file, char *buf, size_t buf_size)
>                 return -EOPNOTSUPP;
>
>         mutex_lock(&iint->mutex);
> +
> +       /*
> +        * ima_file_hash can be called when ima_collect_measurement has still
> +        * not been called, we might not always have a hash.
> +        */
> +       if (!iint->ima_hash) {
> +               mutex_unlock(&iint->mutex);
> +               return -EOPNOTSUPP;
> +       }
> +
>         if (buf) {
>                 size_t copied_size;
>
> --
> 2.28.0.526.ge36021eeef-goog
>

  reply	other threads:[~2020-09-16 18:57 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-16 12:49 [PATCH v2] ima: Fix NULL pointer dereference in ima_file_hash KP Singh
2020-09-16 13:36 ` KP Singh [this message]
2020-09-16 16:00 ` Mimi Zohar
2020-09-16 16:59   ` KP Singh

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='CACYkzJ45nu=WZeQ0uwL+QxsCxhgkvSmXtme08q60GG_M0rzW8A@mail.gmail.com' \
    --to=kpsingh@chromium.org \
    --cc=linux-security-module@vger.kernel.org \
    /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).