Re: [PATCH] crypto: talitos - fix ablkcipher for CONFIG_VMAP_STACK

From: Herbert Xu
Date: Tue Dec 11 2018 - 04:26:19 EST


On Tue, Dec 11, 2018 at 07:29:40AM +0000, Christophe Leroy wrote:
>
> diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
> index 6988012deca4..385ec970b639 100644
> --- a/drivers/crypto/talitos.c
> +++ b/drivers/crypto/talitos.c
> @@ -1668,8 +1668,11 @@ static struct talitos_edesc *ablkcipher_edesc_alloc(struct ablkcipher_request *
> struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher);
> unsigned int ivsize = crypto_ablkcipher_ivsize(cipher);
>
> + if (ivsize)
> + memcpy(ctx->iv, areq->info, ivsize);

The ctx is per-tfm, not per-request. So you cannot write to it.
This needs to go into a pre-request area.

> return talitos_edesc_alloc(ctx->dev, areq->src, areq->dst,
> - areq->info, 0, areq->nbytes, 0, ivsize, 0,
> + ctx->iv, 0, areq->nbytes, 0, ivsize, 0,
> areq->base.flags, encrypt);
> }

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