VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   55 Tags
author: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> 2021-01-19 00:13:19 +0000 committer: Linus Torvalds <torvalds@linux-foundation.org> 2021-01-20 11:33:51 -0800 commit: 7178a107f5ea7bdb1cc23073234f0ded0ef90ec7 parent: db58465f1121086b524be80be39d1fedbe5387f3
Commit Summary:
X.509: Fix crash caused by NULL pointer
Diffstat:
1 file changed, 2 insertions, 1 deletion
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 8892908ad58c..788a4ba1e2e7 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -356,7 +356,8 @@ int public_key_verify_signature(const struct public_key *pkey,
 	if (ret)
 		goto error_free_key;
 
-	if (strcmp(sig->pkey_algo, "sm2") == 0 && sig->data_size) {
+	if (sig->pkey_algo && strcmp(sig->pkey_algo, "sm2") == 0 &&
+	    sig->data_size) {
 		ret = cert_sig_digest_update(sig, tfm);
 		if (ret)
 			goto error_free_key;