Skip to content

Commit

Permalink
crypto: tcrypt - Fix multibuffer skcipher speed test mem leak
Browse files Browse the repository at this point in the history
[ Upstream commit 1aa33fc ]

In the past, the data for mb-skcipher test has been allocated
twice, that means the first allcated memory area is without
free, which may cause a potential memory leakage. So this
patch is to remove one allocation to fix this error.

Fixes: e161c59 ("crypto: tcrypt - add multibuf skcipher...")
Signed-off-by: Zhang Yiqun <zhangyiqun@phytium.com.cn>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
CoveyZhang authored and gregkh committed Dec 31, 2022
1 parent bfe10a1 commit 221afb2
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions crypto/tcrypt.c
Expand Up @@ -1295,15 +1295,6 @@ static void test_mb_skcipher_speed(const char *algo, int enc, int secs,
goto out_free_tfm;
}


for (i = 0; i < num_mb; ++i)
if (testmgr_alloc_buf(data[i].xbuf)) {
while (i--)
testmgr_free_buf(data[i].xbuf);
goto out_free_tfm;
}


for (i = 0; i < num_mb; ++i) {
data[i].req = skcipher_request_alloc(tfm, GFP_KERNEL);
if (!data[i].req) {
Expand Down

0 comments on commit 221afb2

Please sign in to comment.