Message ID | 20170529132622.6tapug7i7aqmvnqz@mwanda (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Herbert Xu |
Headers | show |
On Mon, May 29, 2017 at 04:26:22PM +0300, Dan Carpenter wrote: > 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> > --- > v2: Style change Patch applied. Thanks.
Herbert Xu <herbert@gondor.apana.org.au> wrote:
> Patch applied. Thanks.
Note that I've passed this on to James to pass on to Linus along with a bunch
of other patches.
David
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) } } + ret = -ENOMEM; cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL); if (!cert->pub->key) goto error_decode;
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> --- v2: Style change Sorry for the delay, I'm been out of office.