Skip to content

Commit 3bca64c

Browse files
Dan Carpenterherbertx
authored andcommitted
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: db6c43b ("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>
1 parent a18ccc3 commit 3bca64c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

‎crypto/asymmetric_keys/x509_cert_parser.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ struct x509_certificate *x509_cert_parse(const void *data, size_t datalen)
102102
}
103103
}
104104

105+
ret = -ENOMEM;
105106
cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL);
106107
if (!cert->pub->key)
107108
goto error_decode;

0 commit comments

Comments
 (0)