linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: linux-crypto@vger.kernel.org,
	syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.com,
	Eric Biggers <ebiggers@google.com>
Subject: Re: [PATCH v3] crypto: api - check for ERR pointers in crypto_destroy_tfm()
Date: Sat, 13 Mar 2021 00:12:36 +1100	[thread overview]
Message-ID: <20210312131235.GF31502@gondor.apana.org.au> (raw)
In-Reply-To: <20210302203303.40881-1-ardb@kernel.org>

On Tue, Mar 02, 2021 at 09:33:03PM +0100, Ard Biesheuvel wrote:
> Given that crypto_alloc_tfm() may return ERR pointers, and to avoid
> crashes on obscure error paths where such pointers are presented to
> crypto_destroy_tfm() (such as [0]), add an ERR_PTR check there
> before dereferencing the second argument as a struct crypto_tfm
> pointer.
> 
> [0] https://lore.kernel.org/linux-crypto/000000000000de949705bc59e0f6@google.com/
> 
> Reported-by: syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.com
> Reviewed-by: Eric Biggers <ebiggers@google.com>
> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> ---
> v3: missed crypto_free_shash() in v2
>     add Eric's Rb
> v2: update kerneldoc comments of callers to crypto_destroy_tfm() that NULL or
>     error pointers are ignored.
> 
>  crypto/api.c               | 2 +-
>  include/crypto/acompress.h | 2 ++
>  include/crypto/aead.h      | 2 ++
>  include/crypto/akcipher.h  | 2 ++
>  include/crypto/hash.h      | 4 ++++
>  include/crypto/kpp.h       | 2 ++
>  include/crypto/rng.h       | 2 ++
>  include/crypto/skcipher.h  | 2 ++
>  8 files changed, 17 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

      reply	other threads:[~2021-03-12 13:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 20:33 [PATCH v3] crypto: api - check for ERR pointers in crypto_destroy_tfm() Ard Biesheuvel
2021-03-12 13:12 ` Herbert Xu [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=20210312131235.GF31502@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=ardb@kernel.org \
    --cc=ebiggers@google.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.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).