diff options
author | Gary R Hook <gary.hook@amd.com> | 2019-07-30 16:05:22 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-08-16 10:12:38 +0200 |
commit | 1c4393df3622d4a00aadff617b8fbcddc3c17204 (patch) | |
tree | fb83a01ee638bfc65f9ede90de702661170af9a4 /drivers/crypto | |
parent | b9de21575a20a1c252b820555433c48ae978e70d (diff) | |
download | linux-stable-1c4393df3622d4a00aadff617b8fbcddc3c17204.tar.gz linux-stable-1c4393df3622d4a00aadff617b8fbcddc3c17204.tar.bz2 linux-stable-1c4393df3622d4a00aadff617b8fbcddc3c17204.zip |
crypto: ccp - Fix oops by properly managing allocated structures
commit 25e44338321af545ab34243a6081c3f0fc6107d0 upstream.
A plaintext or ciphertext length of 0 is allowed in AES, in which case
no encryption occurs. Ensure that we don't clean up data structures
that were never allocated.
Fixes: 36cf515b9bbe2 ("crypto: ccp - Enable support for AES GCM on v5 CCPs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto')
-rw-r--r-- | drivers/crypto/ccp/ccp-ops.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index e212badd39fa..43129a5b69fe 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -862,11 +862,11 @@ e_tag: ccp_dm_free(&final_wa); e_dst: - if (aes->src_len && !in_place) + if (ilen > 0 && !in_place) ccp_free_data(&dst, cmd_q); e_src: - if (aes->src_len) + if (ilen > 0) ccp_free_data(&src, cmd_q); e_aad: |