From: Tim Chen <tim.c.chen@linux.intel.com>
To: Christian Engelmayer <cengelma@gmx.at>
Cc: herbert@gondor.apana.org.au, davem@davemloft.net,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] crypto: Fix potential leak in test_aead_speed() if aad_size is too big
Date: Wed, 23 Apr 2014 10:20:28 -0700 [thread overview]
Message-ID: <1398273628.2970.53.camel@schen9-DESK> (raw)
In-Reply-To: <20140421204559.75b8aa71@spike>
On Mon, 2014-04-21 at 20:45 +0200, Christian Engelmayer wrote:
> Fix a potential memory leak in the error handling of test_aead_speed(). In case
> the size check on the associate data length parameter fails, the function goes
> through the wrong exit label. Reported by Coverity - CID 1163870.
>
> Signed-off-by: Christian Engelmayer <cengelma@gmx.at>
Acked.
Tim
> ---
> crypto/tcrypt.c | 14 ++++++--------
> 1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c
> index 870be7b..1856d7f 100644
> --- a/crypto/tcrypt.c
> +++ b/crypto/tcrypt.c
> @@ -282,6 +282,11 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
> unsigned int *b_size;
> unsigned int iv_len;
>
> + if (aad_size >= PAGE_SIZE) {
> + pr_err("associate data length (%u) too big\n", aad_size);
> + return;
> + }
> +
> if (enc == ENCRYPT)
> e = "encryption";
> else
> @@ -323,14 +328,7 @@ static void test_aead_speed(const char *algo, int enc, unsigned int sec,
> b_size = aead_sizes;
> do {
> assoc = axbuf[0];
> -
> - if (aad_size < PAGE_SIZE)
> - memset(assoc, 0xff, aad_size);
> - else {
> - pr_err("associate data length (%u) too big\n",
> - aad_size);
> - goto out_nosg;
> - }
> + memset(assoc, 0xff, aad_size);
> sg_init_one(&asg[0], assoc, aad_size);
>
> if ((*keysize + *b_size) > TVMEMSIZE * PAGE_SIZE) {
next prev parent reply other threads:[~2014-04-23 17:20 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 18:44 [PATCH 0/3] Cleanup ressource leaks in test_aead_speed() Christian Engelmayer
2014-04-21 18:45 ` [PATCH 1/3] crypto: Fix potential leak in test_aead_speed() if aad_size is too big Christian Engelmayer
2014-04-22 23:33 ` Marek Vasut
2014-04-23 17:43 ` Christian Engelmayer
2014-04-23 17:44 ` Marek Vasut
2014-04-23 17:20 ` Tim Chen [this message]
2014-04-21 18:46 ` [PATCH 2/3] crypto: Fix potential leak in test_aead_speed() if crypto_alloc_aead() fails Christian Engelmayer
2014-04-22 23:35 ` Marek Vasut
2014-04-23 17:20 ` Tim Chen
2014-04-21 18:47 ` [PATCH 3/3] crypto: Fix leak of struct aead_request in test_aead_speed() Christian Engelmayer
2014-04-22 23:36 ` Marek Vasut
2014-04-23 17:26 ` Tim Chen
2014-04-28 10:25 ` [PATCH 0/3] Cleanup ressource leaks " Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1398273628.2970.53.camel@schen9-DESK \
--to=tim.c.chen@linux.intel.com \
--cc=cengelma@gmx.at \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox