summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2019-06-02 22:42:33 -0700
committerHerbert Xu <herbert@gondor.apana.org.au>2019-06-13 14:31:40 +0800
commite63e1b0dd0003dc31f73d875907432be3a2abe5d (patch)
treed167cb48490dd9b76c1b0cd2921429df97153fda /crypto
parent177f87d063ebc7a11a38bdafaca8fec4a9dae13e (diff)
downloadlinux-e63e1b0dd0003dc31f73d875907432be3a2abe5d.tar.gz
crypto: testmgr - add some more preemption points
Call cond_resched() after each fuzz test iteration.  This avoids stall
warnings if fuzz_iterations is set very high for testing purposes.

While we're at it, also call cond_resched() after finishing testing each
test vector.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/testmgr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c
index 2ba0c487ea28..f7fdd7fe89a9 100644
--- a/crypto/testmgr.c
+++ b/crypto/testmgr.c
@@ -1496,6 +1496,7 @@ static int test_hash_vec(const char *driver, const struct hash_testvec *vec,
 						req, desc, tsgl, hashstate);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -1764,6 +1765,7 @@ static int __alg_test_hash(const struct hash_testvec *vecs,
 				    hashstate);
 		if (err)
 			goto out;
+		cond_resched();
 	}
 	err = test_hash_vs_generic_impl(driver, generic_driver, maxkeysize, req,
 					desc, tsgl, hashstate);
@@ -2028,6 +2030,7 @@ static int test_aead_vec(const char *driver, int enc,
 						&cfg, req, tsgls);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -2267,6 +2270,7 @@ static int test_aead(const char *driver, int enc,
 				    tsgls);
 		if (err)
 			return err;
+		cond_resched();
 	}
 	return 0;
 }
@@ -2609,6 +2613,7 @@ static int test_skcipher_vec(const char *driver, int enc,
 						    &cfg, req, tsgls);
 			if (err)
 				return err;
+			cond_resched();
 		}
 	}
 #endif
@@ -2808,6 +2813,7 @@ static int test_skcipher(const char *driver, int enc,
 					tsgls);
 		if (err)
 			return err;
+		cond_resched();
 	}
 	return 0;
 }