Re: crypto: xts - Fix atomic sleep when walking skcipher

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Apr 14, 2019 at 09:35:13AM -0700, Eric Biggers wrote:
>
> This isn't correct because skcipher_walk_virt() can still sleep when
> atomic=true, since it may need to copy the IV.  That's why I added might_sleep()
> to it in commit bb648291fc04, and that's what's triggering here.

Thanks for catching this Eric!

> This is the correct fix:
> 
> diff --git a/crypto/xts.c b/crypto/xts.c
> index aed11e63ca315..359ef15e1673e 100644
> --- a/crypto/xts.c
> +++ b/crypto/xts.c
> @@ -101,6 +101,7 @@ static int xor_tweak(struct skcipher_request *req, bool second_pass)
>  		req = &rctx->subreq;
>  		/* set to our TFM to enforce correct alignment: */
>  		skcipher_request_set_tfm(req, tfm);
> +		req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP;
>  	}

This is what I'm doing in v2, except I've moved it over to
crypt_done so that we don't affect the synchronous path.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux