diff options
author | Weili Qian <qianweili@huawei.com> | 2021-12-11 09:17:19 +0100 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2021-12-17 06:59:48 +0100 |
commit | 51fa916b81e5f406a74f14a31a3a228c3cc060ad (patch) | |
tree | d8cdd092c855ed59eb824ff86817a8e205b9422f /drivers/crypto | |
parent | crypto: api - Replace kernel.h with the necessary inclusions (diff) | |
download | linux-51fa916b81e5f406a74f14a31a3a228c3cc060ad.tar.xz linux-51fa916b81e5f406a74f14a31a3a228c3cc060ad.zip |
crypto: hisilicon/hpre - fix memory leak in hpre_curve25519_src_init()
hpre_curve25519_src_init() allocates memory for 'ptr' before calling
memcmp(). If memcmp() returns 0, the function will return '-EINVAL'
without freeing memory.
Signed-off-by: Weili Qian <qianweili@huawei.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/hisilicon/hpre/hpre_crypto.c index 0f1724d355b8..97d54c1465c2 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -1862,7 +1862,7 @@ static int hpre_curve25519_src_init(struct hpre_asym_request *hpre_req, */ if (memcmp(ptr, p, ctx->key_sz) == 0) { dev_err(dev, "gx is p!\n"); - return -EINVAL; + goto err; } else if (memcmp(ptr, p, ctx->key_sz) > 0) { hpre_curve25519_src_modulo_p(ptr); } |