]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: ccp - memset request context to zero during import
authorTom Lendacky <thomas.lendacky@amd.com>
Thu, 25 Feb 2016 22:48:13 +0000 (16:48 -0600)
committerSasha Levin <sasha.levin@oracle.com>
Mon, 18 Apr 2016 12:50:41 +0000 (08:50 -0400)
[ Upstream commit ce0ae266feaf35930394bd770c69778e4ef03ba9 ]

Since a crypto_ahash_import() can be called against a request context
that has not had a crypto_ahash_init() performed, the request context
needs to be cleared to insure there is no random data present. If not,
the random data can result in a kernel oops during crypto_ahash_update().

Cc: <stable@vger.kernel.org> # 3.14.x-
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/crypto/ccp/ccp-crypto-aes-cmac.c
drivers/crypto/ccp/ccp-crypto-sha.c

index 8680b189e86c51468281482aaa965a683e81b40f..0a4973b47c997b91d73cb8da71aad20713c00337 100644 (file)
@@ -226,6 +226,7 @@ static int ccp_aes_cmac_import(struct ahash_request *req, const void *in)
        /* 'in' may not be aligned so memcpy to local variable */
        memcpy(&state, in, sizeof(state));
 
+       memset(rctx, 0, sizeof(*rctx));
        rctx->null_msg = state.null_msg;
        memcpy(rctx->iv, state.iv, sizeof(rctx->iv));
        rctx->buf_count = state.buf_count;
index e9b199f4913afe1b492aab3234c291feaf7349b7..9711b6d291628f3574bfd187316713c33b19386b 100644 (file)
@@ -220,6 +220,7 @@ static int ccp_sha_import(struct ahash_request *req, const void *in)
        /* 'in' may not be aligned so memcpy to local variable */
        memcpy(&state, in, sizeof(state));
 
+       memset(rctx, 0, sizeof(*rctx));
        rctx->type = state.type;
        rctx->msg_bits = state.msg_bits;
        rctx->first = state.first;