summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorTianjia Zhang <tianjia.zhang@linux.alibaba.com>2020-10-05 16:46:28 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2020-10-08 07:38:06 +0200
commit4f28945da0c502c794eb4e4d535d3ba65d3c9769 (patch)
tree11789af587b413c019e709ec30c037dc54001726 /crypto
parentcrypto: bcm - Verify GCM/CCM key length in setkey (diff)
downloadlinux-4f28945da0c502c794eb4e4d535d3ba65d3c9769.tar.xz
linux-4f28945da0c502c794eb4e4d535d3ba65d3c9769.zip
X.509: fix error return value on the failed path
When memory allocation fails, an appropriate return value should be set. Fixes: 215525639631 ("X.509: support OSCCA SM2-with-SM3 certificate verification") Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asymmetric_keys/public_key_sm2.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/asymmetric_keys/public_key_sm2.c b/crypto/asymmetric_keys/public_key_sm2.c
index 7325cf21dbb4..66b614e1eccd 100644
--- a/crypto/asymmetric_keys/public_key_sm2.c
+++ b/crypto/asymmetric_keys/public_key_sm2.c
@@ -36,8 +36,10 @@ int cert_sig_digest_update(const struct public_key_signature *sig,
desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
desc = kzalloc(desc_size, GFP_KERNEL);
- if (!desc)
+ if (!desc) {
+ ret = -ENOMEM;
goto error_free_tfm;
+ }
desc->tfm = tfm;