Skip to content
Snippets Groups Projects
Commit 6bbf4a5a authored by Ard Biesheuvel's avatar Ard Biesheuvel Committed by Yang Yingliang
Browse files

crypto: api - check for ERR pointers in crypto_destroy_tfm()

stable inclusion
from linux-4.19.191
commit 67afaf1a0a3b2e23645c86636d887a7ca84a09ed

--------------------------------

[ Upstream commit 83681f2bebb34dbb3f03fecd8f570308ab8b7c2c ]

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: default avatar <syzbot+12cf5fbfdeba210a89dd@syzkaller.appspotmail.com>
Reviewed-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
parent 9d9b8c95
No related branches found
No related tags found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment