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/000000000000de949705bc59e...@google.com/
> 
> Reported-by: syzbot+12cf5fbfdeba210a8...@syzkaller.appspotmail.com
> Reviewed-by: Eric Biggers <ebigg...@google.com>
> Signed-off-by: Ard Biesheuvel <a...@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 <herb...@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

Reply via email to