diff options
author | Christian Engelmayer <cengelma@gmx.at> | 2014-04-21 14:46:40 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-04-28 06:21:18 -0400 |
commit | a2ea6ed6a631e24d315b5f2bd468e6f4c7ff2e48 (patch) | |
tree | 5157deba32e0d1a096629c9a0d9451c669bc3a5d /crypto/tcrypt.c | |
parent | ac5f863f8c548ab72511213b30368cfc8007ae01 (diff) |
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>
Diffstat (limited to 'crypto/tcrypt.c')
-rw-r--r-- | crypto/tcrypt.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 1856d7ff2688..18491552b83a 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c | |||
@@ -313,7 +313,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec, | |||
313 | if (IS_ERR(tfm)) { | 313 | if (IS_ERR(tfm)) { |
314 | pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo, | 314 | pr_err("alg: aead: Failed to load transform for %s: %ld\n", algo, |
315 | PTR_ERR(tfm)); | 315 | PTR_ERR(tfm)); |
316 | return; | 316 | goto out_notfm; |
317 | } | 317 | } |
318 | 318 | ||
319 | req = aead_request_alloc(tfm, GFP_KERNEL); | 319 | req = aead_request_alloc(tfm, GFP_KERNEL); |
@@ -391,6 +391,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec, | |||
391 | 391 | ||
392 | out: | 392 | out: |
393 | crypto_free_aead(tfm); | 393 | crypto_free_aead(tfm); |
394 | out_notfm: | ||
394 | kfree(sg); | 395 | kfree(sg); |
395 | out_nosg: | 396 | out_nosg: |
396 | testmgr_free_buf(xoutbuf); | 397 | testmgr_free_buf(xoutbuf); |