Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ccp - memset request context to zero during import

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>

authored by

Tom Lendacky and committed by
Herbert Xu
ce0ae266 9c6bd0c2

+2
+1
drivers/crypto/ccp/ccp-crypto-aes-cmac.c
··· 244 244 /* 'in' may not be aligned so memcpy to local variable */ 245 245 memcpy(&state, in, sizeof(state)); 246 246 247 + memset(rctx, 0, sizeof(*rctx)); 247 248 rctx->null_msg = state.null_msg; 248 249 memcpy(rctx->iv, state.iv, sizeof(rctx->iv)); 249 250 rctx->buf_count = state.buf_count;
+1
drivers/crypto/ccp/ccp-crypto-sha.c
··· 233 233 /* 'in' may not be aligned so memcpy to local variable */ 234 234 memcpy(&state, in, sizeof(state)); 235 235 236 + memset(rctx, 0, sizeof(*rctx)); 236 237 rctx->type = state.type; 237 238 rctx->msg_bits = state.msg_bits; 238 239 rctx->first = state.first;