crypto: hisilicon/hpre - fix memory leak in hpre_curve25519_src_init()
authorWeili Qian <qianweili@huawei.com>
Sat, 11 Dec 2021 08:17:19 +0000 (16:17 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:04:44 +0000 (11:04 +0100)
commit4586d164c319a81aa98169bb863de5c3112f13e5
tree3c05dd9eb3747383f79216762354d16e0e2f9f6b
parentc0713b3017a8057819173830dc273c8fec4b0b77
crypto: hisilicon/hpre - fix memory leak in hpre_curve25519_src_init()

[ Upstream commit 51fa916b81e5f406a74f14a31a3a228c3cc060ad ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/hisilicon/hpre/hpre_crypto.c