diff options
author | Eric Biggers <ebiggers@google.com> | 2018-12-15 12:41:53 -0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2018-12-23 11:52:44 +0800 |
commit | 8e3ba5a383effea52ff0f1d7036451857332429b (patch) | |
tree | 145601d5b052578f21edafca4d2157fb27b428a4 | |
parent | ffd2a44a3659e1ecbb78cd1aa253f9cc13d6f19e (diff) | |
download | linux-crypto-8e3ba5a383effea52ff0f1d7036451857332429b.tar.gz linux-crypto-8e3ba5a383effea52ff0f1d7036451857332429b.zip |
crypto: skcipher - add might_sleep() to skcipher_walk_virt()
skcipher_walk_virt() can still sleep even with atomic=true, since that
only affects the later calls to skcipher_walk_done(). But,
skcipher_walk_virt() only has to allocate memory for some input data
layouts, so incorrectly calling it with preemption disabled can go
undetected. Use might_sleep() so that it's detected reliably.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/skcipher.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c index 17be8d9c..41b4f7f2 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -474,6 +474,8 @@ int skcipher_walk_virt(struct skcipher_walk *walk, { int err; + might_sleep_if(req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP); + walk->flags &= ~SKCIPHER_WALK_PHYS; err = skcipher_walk_skcipher(walk, req); |