* [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate()
@ 2021-03-05 1:57 Jia-Ju Bai
2021-03-09 6:44 ` Corentin Labbe
2021-03-12 13:13 ` Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2021-03-05 1:57 UTC (permalink / raw)
To: clabbe.montjoie, herbert, davem, mripard, wens, jernej.skrabec,
mchehab+huawei, corbet
Cc: linux-crypto, linux-arm-kernel, linux-kernel, Jia-Ju Bai
When dma_mapping_error() returns an error, no error return code of
sun8i_ce_prng_generate() is assigned.
To fix this bug, err is assigned with -EFAULT as error return code.
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
index cfde9ee4356b..cd1baee424a1 100644
--- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
+++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
@@ -99,6 +99,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 *src,
dma_iv = dma_map_single(ce->dev, ctx->seed, ctx->slen, DMA_TO_DEVICE);
if (dma_mapping_error(ce->dev, dma_iv)) {
dev_err(ce->dev, "Cannot DMA MAP IV\n");
+ err = -EFAULT;
goto err_iv;
}
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate()
2021-03-05 1:57 [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate() Jia-Ju Bai
@ 2021-03-09 6:44 ` Corentin Labbe
2021-03-12 13:13 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Corentin Labbe @ 2021-03-09 6:44 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: herbert, davem, mripard, wens, jernej.skrabec, mchehab+huawei,
corbet, linux-crypto, linux-arm-kernel, linux-kernel
Le Thu, Mar 04, 2021 at 05:57:17PM -0800, Jia-Ju Bai a écrit :
> When dma_mapping_error() returns an error, no error return code of
> sun8i_ce_prng_generate() is assigned.
> To fix this bug, err is assigned with -EFAULT as error return code.
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
> index cfde9ee4356b..cd1baee424a1 100644
> --- a/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
> +++ b/drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c
> @@ -99,6 +99,7 @@ int sun8i_ce_prng_generate(struct crypto_rng *tfm, const u8 *src,
> dma_iv = dma_map_single(ce->dev, ctx->seed, ctx->slen, DMA_TO_DEVICE);
> if (dma_mapping_error(ce->dev, dma_iv)) {
> dev_err(ce->dev, "Cannot DMA MAP IV\n");
> + err = -EFAULT;
> goto err_iv;
> }
>
> --
> 2.17.1
>
Hello
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Thanks
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate()
2021-03-05 1:57 [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate() Jia-Ju Bai
2021-03-09 6:44 ` Corentin Labbe
@ 2021-03-12 13:13 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-03-12 13:13 UTC (permalink / raw)
To: Jia-Ju Bai
Cc: clabbe.montjoie, davem, mripard, wens, jernej.skrabec,
mchehab+huawei, corbet, linux-crypto, linux-arm-kernel,
linux-kernel
On Thu, Mar 04, 2021 at 05:57:17PM -0800, Jia-Ju Bai wrote:
> When dma_mapping_error() returns an error, no error return code of
> sun8i_ce_prng_generate() is assigned.
> To fix this bug, err is assigned with -EFAULT as error return code.
>
> Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-prng.c | 1 +
> 1 file changed, 1 insertion(+)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-12 13:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 1:57 [PATCH] crypto: allwinner: sun8i-ce: fix error return code in sun8i_ce_prng_generate() Jia-Ju Bai
2021-03-09 6:44 ` Corentin Labbe
2021-03-12 13:13 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).