Skip to contentSkip to conversation

crypto: don't use interruptible wait in tests

PATCH In review Rabin Vincent 2 participants 2 messages Jan 9, 2015 – Jan 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: don't use interruptible wait in tests

tcrypt/testmgr uses wait_for_completion_interruptible() everywhere when it waits for a request to be completed. If it's interrupted, then the test is aborted and the request is freed.

However, if any of these calls actually do get interrupted, the result will likely be a kernel crash, when the driver handles the now-freed request. Use wait_for_completion() instead.

---
 crypto/tcrypt.c  |   10 ++++------
 crypto/testmgr.c |   50 ++++++++++++++++++++++----------------------------
 2 files changed, 26 insertions(+), 34 deletions(-)
crypto/tcrypt.c +4 -6
index 1d864e9..0043495 100644
@@ -764,10 +764,9 @@ static inline int do_one_ahash_op(struct ahash_request *req, int ret)
 	if (ret == -EINPROGRESS || ret == -EBUSY) {
 		struct tcrypt_result *tr = req->base.data;
 
-		ret = wait_for_completion_interruptible(&tr->completion);
-		if (!ret)
-			ret = tr->err;
+		wait_for_completion(&tr->completion);
 		reinit_completion(&tr->completion);
+		ret = tr->err;
 	}
 	return ret;
 }
@@ -993,10 +992,9 @@ static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret)
 	if (ret == -EINPROGRESS || ret == -EBUSY) {
 		struct tcrypt_result *tr = req->base.data;
 
-		ret = wait_for_completion_interruptible(&tr->completion);
-		if (!ret)
-			ret = tr->err;
+		wait_for_completion(&tr->completion);
 		reinit_completion(&tr->completion);
+		ret = tr->err;
 	}
 
 	return ret;
crypto/testmgr.c +22 -28

92 lines not on this page · raw message

Signature · 1 line
1.7.10.4
maintainer
#1 lore raw
Quoted 9 lines · Rabin Vincent

tcrypt/testmgr uses wait_for_completion_interruptible() everywhere when it waits for a request to be completed. If it's interrupted, then the test is aborted and the request is freed.

However, if any of these calls actually do get interrupted, the result will likely be a kernel crash, when the driver handles the now-freed request. Use wait_for_completion() instead.

Patch applied. Thanks!

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt