Re: [PATCH] crypto: hisilicon/hpre - fix unmapping invalid dma address

From: Herbert Xu
Date: Fri Apr 16 2021 - 07:27:00 EST


On Sat, Apr 10, 2021 at 05:49:17PM +0800, Hui Tang wrote:
> Currently, an invalid dma address may be unmapped when calling
> 'xx_data_clr_all' in error path, so check dma address of sqe in/out
> whether it has been mapped before calling 'dma_free_coherent' or
> 'dma_unmap_single'.
>
> An abnormal case is as follows:
> hpre_curve25519_compute_value
> -> hpre_curve25519_src_init
> -> hpre_curve25519_hw_data_clr_all
>
> Fixes: a9214b0b6ed2(crypto: hisilicon - fix the check on dma address)
> Signed-off-by: Hui Tang <tanghui20@xxxxxxxxxx>
> ---
> drivers/crypto/hisilicon/hpre/hpre_crypto.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)

This triggers new sparse warnings.

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