Linux FSCRYPT development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Jia-Ju Bai <baijiaju1990@gmail.com>
Cc: tytso@mit.edu, jaegeuk@kernel.org, linux-fscrypt@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org
Subject: Re: [PATCH] fs: crypto: keyinfo: Fix a possible null-pointer dereference in derive_key_aes()
Date: Wed, 24 Jul 2019 09:07:11 -0700	[thread overview]
Message-ID: <20190724160711.GB673@sol.localdomain> (raw)
In-Reply-To: <20190724100204.2009-1-baijiaju1990@gmail.com>

[+Cc linux-crypto]

On Wed, Jul 24, 2019 at 06:02:04PM +0800, Jia-Ju Bai wrote:
> In derive_key_aes(), tfm is assigned to NULL on line 46, and then
> crypto_free_skcipher(tfm) is executed.
> 
> crypto_free_skcipher(tfm)
>     crypto_skcipher_tfm(tfm)
>         return &tfm->base;
> 
> Thus, a possible null-pointer dereference may occur.

This analysis is incorrect because only the address &tfm->base is taken.
There's no pointer dereference.

In fact all the crypto_free_*() functions are no-ops on NULL pointers, and many
other callers rely on it.  So there's no bug here.

It appears you've sent the same patch for some of these other callers
(https://lore.kernel.org/lkml/?q=%22fix+a+possible+null-pointer%22), but none
are Cc'ed to linux-crypto or another mailing list I'm subscribed to, so I can't
respond to them.  But this feedback applies equally to them too.

Note also that if there actually were a bug here (which again, there doesn't
appear to be), we'd need to fix it in crypto_free_*(), not in the callers.

- Eric

  reply	other threads:[~2019-07-24 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-24 10:02 [PATCH] fs: crypto: keyinfo: Fix a possible null-pointer dereference in derive_key_aes() Jia-Ju Bai
2019-07-24 16:07 ` Eric Biggers [this message]
2019-07-25  3:30   ` Jia-Ju Bai
2019-07-25  3:33     ` Jia-Ju Bai
2019-07-25  3:39       ` Eric Biggers
2019-07-25  3:52         ` Jia-Ju Bai

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=20190724160711.GB673@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=baijiaju1990@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    /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