mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
crypto: api - check for ERR pointers in crypto_destroy_tfm()
[ 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/[email protected]/ Reported-by: [email protected] Reviewed-by: Eric Biggers <[email protected]> Signed-off-by: Ard Biesheuvel <[email protected]> Signed-off-by: Herbert Xu <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
This commit is contained in:
parent
8ac79bdcc0
commit
69f1a9702d
8 changed files with 17 additions and 1 deletions
|
|
@ -568,7 +568,7 @@ void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
|
|||
{
|
||||
struct crypto_alg *alg;
|
||||
|
||||
if (unlikely(!mem))
|
||||
if (IS_ERR_OR_NULL(mem))
|
||||
return;
|
||||
|
||||
alg = tfm->__crt_alg;
|
||||
|
|
|
|||
Loading…
Reference in a new issue