Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: rockchip: fail ahash requests on HASH idle timeout
@ 2026-06-23 13:55 Pengpeng Hou
  2026-07-05  8:41 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Pengpeng Hou @ 2026-06-23 13:55 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu, David S. Miller, Heiko Stuebner,
	John Keeping
  Cc: Pengpeng Hou, linux-crypto, linux-arm-kernel, linux-rockchip,
	linux-kernel

rk_hash_run() waits for RK_CRYPTO_HASH_STS to become idle after the
final DMA transfer, but ignores the poll result. If the hash engine
never becomes idle, the driver still reads the digest registers and
finalizes the request with the previous success value.

Store the poll result and finalize the request with the timeout error
before reading the digest registers.

Fixes: 37bc22159c45 ("crypto: rockchip - use read_poll_timeout")
Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
---
 drivers/crypto/rockchip/rk3288_crypto_ahash.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/rockchip/rk3288_crypto_ahash.c b/drivers/crypto/rockchip/rk3288_crypto_ahash.c
index b9f5a8b42..d3482619a 100644
--- a/drivers/crypto/rockchip/rk3288_crypto_ahash.c
+++ b/drivers/crypto/rockchip/rk3288_crypto_ahash.c
@@ -324,7 +324,12 @@ static int rk_hash_run(struct crypto_engine *engine, void *breq)
 	 * efficiency, and make it response quickly when dma
 	 * complete.
 	 */
-	readl_poll_timeout(rkc->reg + RK_CRYPTO_HASH_STS, v, v == 0, 10, 1000);
+	err = readl_poll_timeout(rkc->reg + RK_CRYPTO_HASH_STS, v,
+				 v == 0, 10, 1000);
+	if (err) {
+		dev_err(rkc->dev, "HASH idle timeout\n");
+		goto theend;
+	}
 
 	for (i = 0; i < crypto_ahash_digestsize(tfm) / 4; i++) {
 		v = readl(rkc->reg + RK_CRYPTO_HASH_DOUT_0 + i * 4);
-- 
2.50.1 (Apple Git-155)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] crypto: rockchip: fail ahash requests on HASH idle timeout
  2026-06-23 13:55 [PATCH] crypto: rockchip: fail ahash requests on HASH idle timeout Pengpeng Hou
@ 2026-07-05  8:41 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-07-05  8:41 UTC (permalink / raw)
  To: Pengpeng Hou
  Cc: Corentin Labbe, David S. Miller, Heiko Stuebner, John Keeping,
	linux-crypto, linux-arm-kernel, linux-rockchip, linux-kernel

On Tue, Jun 23, 2026 at 09:55:28PM +0800, Pengpeng Hou wrote:
> rk_hash_run() waits for RK_CRYPTO_HASH_STS to become idle after the
> final DMA transfer, but ignores the poll result. If the hash engine
> never becomes idle, the driver still reads the digest registers and
> finalizes the request with the previous success value.
> 
> Store the poll result and finalize the request with the timeout error
> before reading the digest registers.
> 
> Fixes: 37bc22159c45 ("crypto: rockchip - use read_poll_timeout")
> Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
> ---
>  drivers/crypto/rockchip/rk3288_crypto_ahash.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-05  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-23 13:55 [PATCH] crypto: rockchip: fail ahash requests on HASH idle timeout Pengpeng Hou
2026-07-05  8:41 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox