Message ID | 20181215204153.8016-1-ebiggers@kernel.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
Series | crypto: skcipher - add might_sleep() to skcipher_walk_virt() | expand |
On Sat, Dec 15, 2018 at 12:41:53PM -0800, Eric Biggers wrote: > From: Eric Biggers <ebiggers@google.com> > > 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> > --- > crypto/skcipher.c | 2 ++ > 1 file changed, 2 insertions(+) Patch applied. Thanks.
diff --git a/crypto/skcipher.c b/crypto/skcipher.c index 17be8d9c714eb..41b4f7f27f454 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);