aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/cryptodev/files/0023-remove-MAY_BACKLOG-flag-from-requests.patch
blob: 32c3ddd512b6c5eb4de53af1a475b59ff523ec1b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
From 7d0d0deb255f8c59b0cf6d3944ee2e3be4133b4c Mon Sep 17 00:00:00 2001
From: Alex Porosanu <alexandru.porosanu@freescale.com>
Date: Mon, 19 Oct 2015 11:53:11 +0300
Subject: [PATCH 23/23] remove MAY_BACKLOG flag from requests

cryptodev doesn't implement the backlogging mechanism properly,
since it misses the possibility of sleeping and waiting for
wake-up when the crypto driver below starts working on the
submitted backloggable request.
In case the crypto driver below implements backlogging mechanisms,
this can lead to side-effects such as working on previously-free'ed
data.
This patch removes the MAY_BACKLOG flag from the requests.

Change-Id: Ia3d822b1abfc1a51e2ce3e9682476b2c99d19c5a
Signed-off-by: Alex Porosanu <alexandru.porosanu@freescale.com>
---
 cryptlib.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/cryptlib.c b/cryptlib.c
index 10f5e1a..eba4616 100644
--- a/cryptlib.c
+++ b/cryptlib.c
@@ -194,8 +194,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 			goto error;
 		}
 
-		ablkcipher_request_set_callback(out->async.request,
-					CRYPTO_TFM_REQ_MAY_BACKLOG,
+		ablkcipher_request_set_callback(out->async.request, 0,
 					cryptodev_complete, out->async.result);
 	} else {
 		out->async.arequest = aead_request_alloc(out->async.as, GFP_KERNEL);
@@ -205,8 +204,7 @@ int cryptodev_cipher_init(struct cipher_data *out, const char *alg_name,
 			goto error;
 		}
 
-		aead_request_set_callback(out->async.arequest,
-					CRYPTO_TFM_REQ_MAY_BACKLOG,
+		aead_request_set_callback(out->async.arequest, 0,
 					cryptodev_complete, out->async.result);
 	}
 
@@ -362,9 +360,8 @@ int cryptodev_hash_init(struct hash_data *hdata, const char *alg_name,
 		goto error;
 	}
 
-	ahash_request_set_callback(hdata->async.request,
-			CRYPTO_TFM_REQ_MAY_BACKLOG,
-			cryptodev_complete, hdata->async.result);
+	ahash_request_set_callback(hdata->async.request, 0,
+				   cryptodev_complete, hdata->async.result);
 
 	ret = crypto_ahash_init(hdata->async.request);
 	if (unlikely(ret)) {
@@ -439,8 +436,7 @@ int cryptodev_pkc_offload(struct cryptodev_pkc *pkc)
 	int ret;
 
 	init_completion(&pkc->result.completion);
-	pkc_request_set_callback(pkc->req, CRYPTO_TFM_REQ_MAY_BACKLOG,
-				 cryptodev_complete_asym, pkc);
+	pkc_request_set_callback(pkc->req, 0, cryptodev_complete_asym, pkc);
 	ret = crypto_pkc_op(pkc->req);
 	if (ret != -EINPROGRESS && ret != 0)
 		goto error;
-- 
2.3.5