diff options
| author | Slavin Liu <bolin.liu@seu.edu.cn> | 2026-09-13 20:51:43 +0800 |
|---|---|---|
| committer | Herbert Xu <herbert@gondor.apana.org.au> | 2026-09-18 19:52:43 +1000 |
| commit | a9a2152d292fd0bc73814eb4a127278ee7dd3f6a (patch) | |
| tree | b69881b2ade9e8f849d3d17d608868b7926e6e87 | |
| parent | be51ea091c6563158531e8c74e040552fdb1e28c (diff) | |
crypto: atmel-sha - reject initialization without a device
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
| -rw-r--r-- | drivers/crypto/atmel-sha.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/crypto/atmel-sha.c b/drivers/crypto/atmel-sha.c index 89c0a3bdf4e0..2d70a4107693 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; |
