Skip to content

Commit a2ea6ed

Browse files
Christian Engelmayerherbertx
authored andcommitted
crypto: tcrypt - Fix potential leak in test_aead_speed() if crypto_alloc_aead() fails
Fix a potential memory leak in the error handling of test_aead_speed(). In case crypto_alloc_aead() fails, the function returns without going through the centralized cleanup path. Reported by Coverity - CID 1163870. Signed-off-by: Christian Engelmayer <cengelma@gmx.at> Reviewed-by: Marek Vasut <marex@denx.de> Acked-by: Tim Chen <tim.c.chen@linux.intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent ac5f863 commit a2ea6ed

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎crypto/tcrypt.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
313313
if (IS_ERR(tfm)) {
314314
pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo,
315315
PTR_ERR(tfm));
316-
return;
316+
goto out_notfm;
317317
}
318318

319319
req = aead_request_alloc(tfm, GFP_KERNEL);
@@ -391,6 +391,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
391391

392392
out:
393393
crypto_free_aead(tfm);
394+
out_notfm:
394395
kfree(sg);
395396
out_nosg:
396397
testmgr_free_buf(xoutbuf);

0 commit comments

Comments
 (0)