diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2021-03-02 21:33:03 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2021-03-13 00:04:01 +1100 |
commit | 83681f2bebb34dbb3f03fecd8f570308ab8b7c2c (patch) | |
tree | e77d6a6d5d4eb8a24caf9af6241ead46922c34b6 /include/crypto/acompress.h | |
parent | 98b5ef3e97b16eaeeedb936f8bda3594ff84a70e (diff) | |
download | lwn-83681f2bebb34dbb3f03fecd8f570308ab8b7c2c.tar.gz lwn-83681f2bebb34dbb3f03fecd8f570308ab8b7c2c.zip |
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>
Diffstat (limited to 'include/crypto/acompress.h')
-rw-r--r-- | include/crypto/acompress.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/crypto/acompress.h b/include/crypto/acompress.h index fcde59c65a81..cb3d6b1c655d 100644 --- a/include/crypto/acompress.h +++ b/include/crypto/acompress.h @@ -165,6 +165,8 @@ static inline struct crypto_acomp *crypto_acomp_reqtfm(struct acomp_req *req) * crypto_free_acomp() -- free ACOMPRESS tfm handle * * @tfm: ACOMPRESS tfm handle allocated with crypto_alloc_acomp() + * + * If @tfm is a NULL or error pointer, this function does nothing. */ static inline void crypto_free_acomp(struct crypto_acomp *tfm) { |