summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-05-29 16:26:22 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2017-06-10 12:04:32 +0800
commit3bca64c1b9d2f6e7af4512bd9bfef6909d09cdbc (patch)
treea5b59930cd42e16aeca4c7290f8887c6da5e8572 /crypto
parenta18ccc365f1a29f1b6d7b4a1edbaffb7100fb1f6 (diff)
downloadop-kernel-dev-3bca64c1b9d2f6e7af4512bd9bfef6909d09cdbc.zip
op-kernel-dev-3bca64c1b9d2f6e7af4512bd9bfef6909d09cdbc.tar.gz
X.509: Fix error code in x509_cert_parse()
We forgot to set the error code on this path so it could result in returning NULL which leads to a NULL dereference. Fixes: db6c43bd2132 ("crypto: KEYS: convert public key and digsig asym to the akcipher api") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asymmetric_keys/x509_cert_parser.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index c80765b..dd03fea 100644
--- a/crypto/asymmetric_keys/x509_cert_parser.c
+++ b/crypto/asymmetric_keys/x509_cert_parser.c
@@ -102,6 +102,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
}
}
+ ret = -ENOMEM;
cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL);
if (!cert->pub->key)
goto error_decode;
OpenPOWER on IntegriCloud