* [PATCH] crypto: atmel-sha: reject initialization without a device
@ 2026-09-13 12:51 Slavin Liu
2026-09-18 9:57 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Slavin Liu @ 2026-09-13 12:51 UTC (permalink / raw)
To: herbert, davem, nicolas.ferre, alexandre.belloni, claudiu.beznea
Cc: linux-crypto, linux-arm-kernel, linux-kernel, bolin.liu
A transform may be initialized for the first time after the last
device has been removed from the driver list. Return -ENODEV when the
lookup is empty, before the debug message reads dd->dev.
Detected by static analysis and reviewed with AI-assisted source auditing.
Fixes: ebc82efa1cd6 ("crypto: atmel - add Atmel SHA1/SHA256 driver")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
drivers/crypto/atmel-sha.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c
index 48f54b615504..d2338e731d56 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -422,6 +422,9 @@ static int atmel_sha_init(struct ahash_request *req)
struct atmel_sha_reqctx *ctx = ahash_request_ctx(req);
struct atmel_sha_dev *dd = atmel_sha_find_dev(tctx);
+ if (!dd)
+ return -ENODEV;
+
ctx->dd = dd;
ctx->flags = 0;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] crypto: atmel-sha: reject initialization without a device
2026-09-13 12:51 [PATCH] crypto: atmel-sha: reject initialization without a device Slavin Liu
@ 2026-09-18 9:57 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-09-18 9:57 UTC (permalink / raw)
To: Slavin Liu
Cc: davem, nicolas.ferre, alexandre.belloni, claudiu.beznea,
linux-crypto, linux-arm-kernel, linux-kernel, bolin.liu
Slavin Liu <bolin.liu@seu.edu.cn> wrote:
> A transform may be initialized for the first time after the last
> device has been removed from the driver list. Return -ENODEV when the
> lookup is empty, before the debug message reads dd->dev.
>
> Detected by static analysis and reviewed with AI-assisted source auditing.
>
> Fixes: ebc82efa1cd6 ("crypto: atmel - add Atmel SHA1/SHA256 driver")
> Assisted-by: LLM
> Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
> ---
> drivers/crypto/atmel-sha.c | 3 +++
> 1 file changed, 3 insertions(+)
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-09-18 9:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-13 12:51 [PATCH] crypto: atmel-sha: reject initialization without a device Slavin Liu
2026-09-18 9:57 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox