Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933391AbcDJTTf (ORCPT ); Sun, 10 Apr 2016 15:19:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54695 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933279AbcDJTTS (ORCPT ); Sun, 10 Apr 2016 15:19:18 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Herbert Xu Subject: [PATCH 3.14 37/76] crypto: ccp - memset request context to zero during import Date: Sun, 10 Apr 2016 11:36:45 -0700 Message-Id: <20160410183517.430938828@linuxfoundation.org> X-Mailer: git-send-email 2.8.0 In-Reply-To: <20160410183516.090999097@linuxfoundation.org> References: <20160410183516.090999097@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1582 Lines: 43 3.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tom Lendacky commit ce0ae266feaf35930394bd770c69778e4ef03ba9 upstream. 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(). Signed-off-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- drivers/crypto/ccp/ccp-crypto-aes-cmac.c | 1 + drivers/crypto/ccp/ccp-crypto-sha.c | 1 + 2 files changed, 2 insertions(+) --- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c @@ -225,6 +225,7 @@ static int ccp_aes_cmac_import(struct ah /* '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; --- a/drivers/crypto/ccp/ccp-crypto-sha.c +++ b/drivers/crypto/ccp/ccp-crypto-sha.c @@ -283,6 +283,7 @@ static int ccp_sha_import(struct ahash_r /* '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;