1 From b6f2e7667ad28631b07a70e3c45ac089f5db593f Mon Sep 17 00:00:00 2001
2 From: Gilad Ben-Yossef <gilad@benyossef.com>
3 Date: Sun, 7 Jan 2018 12:14:22 +0000
4 Subject: stating: ccree: revert "staging: ccree: fix leak of import() after
7 commit 293edc27f8bc8a44978e9e95902b07b74f1c7523 upstream
9 This reverts commit c5f39d07860c ("staging: ccree: fix leak of import()
10 after init()") and commit aece09024414 ("staging: ccree: Uninitialized
11 return in ssi_ahash_import()").
13 This is the wrong solution and ends up relying on uninitialized memory,
14 although it was not obvious to me at the time.
16 Cc: stable@vger.kernel.org
17 Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
22 drivers/staging/ccree/ssi_hash.c | 11 ++++-------
23 1 file changed, 4 insertions(+), 7 deletions(-)
25 diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
26 index e266a70a1b32..13291aeaf350 100644
27 --- a/drivers/staging/ccree/ssi_hash.c
28 +++ b/drivers/staging/ccree/ssi_hash.c
29 @@ -1781,7 +1781,7 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in)
30 struct device *dev = &ctx->drvdata->plat_dev->dev;
31 struct ahash_req_ctx *state = ahash_request_ctx(req);
36 memcpy(&tmp, in, sizeof(u32));
37 if (tmp != CC_EXPORT_MAGIC) {
38 @@ -1790,12 +1790,9 @@ static int ssi_ahash_import(struct ahash_request *req, const void *in)
42 - /* call init() to allocate bufs if the user hasn't */
43 - if (!state->digest_buff) {
44 - rc = ssi_hash_init(state, ctx);
48 + rc = ssi_hash_init(state, ctx);
52 dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr,
53 ctx->inter_digestsize, DMA_BIDIRECTIONAL);