OSDN Git Service

crypto: api - check for ERR pointers in crypto_destroy_tfm()
authorArd Biesheuvel <ardb@kernel.org>
Tue, 2 Mar 2021 20:33:03 +0000 (21:33 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 12 Mar 2021 13:04:01 +0000 (00:04 +1100)
commit83681f2bebb34dbb3f03fecd8f570308ab8b7c2c
treee77d6a6d5d4eb8a24caf9af6241ead46922c34b6
parent98b5ef3e97b16eaeeedb936f8bda3594ff84a70e
crypto: api - check for ERR pointers in crypto_destroy_tfm()

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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/api.c
include/crypto/acompress.h
include/crypto/aead.h
include/crypto/akcipher.h
include/crypto/hash.h
include/crypto/kpp.h
include/crypto/rng.h
include/crypto/skcipher.h