mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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>
This commit is contained in:
parent
244d22ffd6
commit
51fa916b81
1 changed files with 1 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue