diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2017-06-08 09:47:49 -0400 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-06-08 23:29:45 -0400 |
commit | 4e880168e9ffb1cdbdb72b3b48ab0324b30c2d62 (patch) | |
tree | 5a709757c0c2bb76f748d8c734321aa0f71cb69c /crypto/asymmetric_keys | |
parent | 381f20fceba8ea540aef5241a9099f4552700d0c (diff) |
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: David Howells <dhowells@redhat.com>
Signed-off-by: James Morris <james.l.morris@oracle.com>
Diffstat (limited to 'crypto/asymmetric_keys')
-rw-r--r-- | crypto/asymmetric_keys/x509_cert_parser.c | 1 |
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 c80765b211cf..dd03fead1ca3 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) | |||
102 | } | 102 | } |
103 | } | 103 | } |
104 | 104 | ||
105 | ret = -ENOMEM; | ||
105 | cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL); | 106 | cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL); |
106 | if (!cert->pub->key) | 107 | if (!cert->pub->key) |
107 | goto error_decode; | 108 | goto error_decode; |