[PATCH 1/5] crypto: Fully restore ahash request before completing

Herbert Xu herbert at gondor.apana.org.au
Fri Dec 20 07:04:08 EST 2013


On Tue, Dec 10, 2013 at 08:26:19PM +0100, Marek Vasut wrote:
> When finishing the ahash request, the ahash_op_unaligned_done() will
> call complete() on the request. Yet, this will not call the correct
> complete callback. The correct complete callback was previously stored
> in the requests' private data, as seen in ahash_op_unaligned(). This
> patch restores the correct complete callback and .data field of the
> request before calling complete() on it.
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Herbert Xu <herbert at gondor.apana.org.au>
> Cc: David S. Miller <davem at davemloft.net>
> Cc: Fabio Estevam <fabio.estevam at freescale.com>
> Cc: Shawn Guo <shawn.guo at linaro.org>
> Cc: linux-crypto at vger.kernel.org
> ---
>  crypto/ahash.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/crypto/ahash.c b/crypto/ahash.c
> index 793a27f..a92dc38 100644
> --- a/crypto/ahash.c
> +++ b/crypto/ahash.c
> @@ -213,7 +213,10 @@ static void ahash_op_unaligned_done(struct crypto_async_request *req, int err)
>  
>  	ahash_op_unaligned_finish(areq, err);
>  
> -	complete(data, err);
> +	areq->base.complete = complete;
> +	areq->base.data = data;
> +
> +	complete(&areq->base, err);

This looks completely bogus.  While restoring areq isn't wrong per
se, calling complete with &areq->base makes no sense.  The original
completion data is in the variable "data".

Which driver relies on this behaviour?

Also, does your subsequent patches rely on this?

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



More information about the linux-arm-kernel mailing list