]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/stating-ccree-revert-staging-ccree-fix-leak-of-impor.patch
084e5b8f83cbe04cb910d20e0e2376586ffe1a10
[thirdparty/kernel/stable-queue.git] / queue-4.14 / stating-ccree-revert-staging-ccree-fix-leak-of-impor.patch
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
5 init()"
6
7 commit 293edc27f8bc8a44978e9e95902b07b74f1c7523 upstream
8
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()").
12
13 This is the wrong solution and ends up relying on uninitialized memory,
14 although it was not obvious to me at the time.
15
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>
21 ---
22 drivers/staging/ccree/ssi_hash.c | 11 ++++-------
23 1 file changed, 4 insertions(+), 7 deletions(-)
24
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);
32 u32 tmp;
33 - int rc = 0;
34 + int rc;
35
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)
39 }
40 in += sizeof(u32);
41
42 - /* call init() to allocate bufs if the user hasn't */
43 - if (!state->digest_buff) {
44 - rc = ssi_hash_init(state, ctx);
45 - if (rc)
46 - goto out;
47 - }
48 + rc = ssi_hash_init(state, ctx);
49 + if (rc)
50 + goto out;
51
52 dma_sync_single_for_cpu(dev, state->digest_buff_dma_addr,
53 ctx->inter_digestsize, DMA_BIDIRECTIONAL);
54 --
55 2.19.1
56