From: Dan Carpenter <dan.carpenter@oracle.com> To: David Howells <dhowells@redhat.com> Cc: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] X.509: Fix error code in x509_cert_parse() Date: Mon, 29 May 2017 16:26:22 +0300 [thread overview] Message-ID: <20170529132622.6tapug7i7aqmvnqz@mwanda> (raw) In-Reply-To: <4045.1495558143@warthog.procyon.org.uk> 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. 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;
WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com> To: David Howells <dhowells@redhat.com> Cc: Herbert Xu <herbert@gondor.apana.org.au>, "David S. Miller" <davem@davemloft.net>, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH v2] X.509: Fix error code in x509_cert_parse() Date: Mon, 29 May 2017 13:26:22 +0000 [thread overview] Message-ID: <20170529132622.6tapug7i7aqmvnqz@mwanda> (raw) In-Reply-To: <4045.1495558143@warthog.procyon.org.uk> 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. 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;
next prev parent reply other threads:[~2017-05-29 13:26 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-05-23 14:27 [PATCH] X.509: Fix error code in x509_cert_parse() Dan Carpenter 2017-05-23 14:27 ` Dan Carpenter 2017-05-23 16:49 ` David Howells 2017-05-23 16:49 ` David Howells 2017-05-29 13:26 ` Dan Carpenter [this message] 2017-05-29 13:26 ` [PATCH v2] " Dan Carpenter 2017-06-10 4:18 ` Herbert Xu 2017-06-10 4:18 ` Herbert Xu 2017-06-10 6:14 ` David Howells 2017-06-10 6:14 ` David Howells
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20170529132622.6tapug7i7aqmvnqz@mwanda \ --to=dan.carpenter@oracle.com \ --cc=davem@davemloft.net \ --cc=dhowells@redhat.com \ --cc=herbert@gondor.apana.org.au \ --cc=kernel-janitors@vger.kernel.org \ --cc=keyrings@vger.kernel.org \ --cc=linux-crypto@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.