lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
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