[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211030133556.5601-1-cyeaa@connect.ust.hk>
Date: Sat, 30 Oct 2021 06:35:56 -0700
From: Chengfeng Ye <cyeaa@...nect.ust.hk>
To: herbert@...dor.apana.org.au, davem@...emloft.net,
nicolas.ferre@...rochip.com, alexandre.belloni@...tlin.com,
ludovic.desroches@...rochip.com
Cc: linux-kernel@...r.kernel.org, Chengfeng Ye <cyeaa@...nect.ust.hk>
Subject: [PATCH] crypto: fix potential null pointer dereference on pointer dd
The return pointer of atmel_sha_find_dev could
be null, there could be potential null-deref issue.
Fix this by adding a null check.
Signed-off-by: Chengfeng Ye <cyeaa@...nect.ust.hk>
---
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 1b13f601fd95..f6ea5aadb86a 100644
--- a/drivers/crypto/atmel-sha.c
+++ b/drivers/crypto/atmel-sha.c
@@ -430,6 +430,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 -EINVAL;
+
ctx->dd = dd;
ctx->flags = 0;
--
2.17.1
Powered by blists - more mailing lists