[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180319155742.13731-233-alexander.levin@microsoft.com>
Date: Mon, 19 Mar 2018 16:02:30 +0000
From: Sasha Levin <Alexander.Levin@...rosoft.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
CC: Dan Carpenter <dan.carpenter@...cle.com>,
David Howells <dhowells@...hat.com>,
James Morris <james.l.morris@...cle.com>,
Sasha Levin <Alexander.Levin@...rosoft.com>
Subject: [PATCH AUTOSEL for 4.9 233/281] X.509: Fix error code in
x509_cert_parse()
From: Dan Carpenter <dan.carpenter@...cle.com>
[ Upstream commit 4e880168e9ffb1cdbdb72b3b48ab0324b30c2d62 ]
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@...cle.com>
Signed-off-by: David Howells <dhowells@...hat.com>
Signed-off-by: James Morris <james.l.morris@...cle.com>
Signed-off-by: Sasha Levin <alexander.levin@...rosoft.com>
---
crypto/asymmetric_keys/x509_cert_parser.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/crypto/asymmetric_keys/x509_cert_parser.c b/crypto/asymmetric_keys/x509_cert_parser.c
index 029f7051f2be..ce2df8c9c583 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;
--
2.14.1
Powered by blists - more mailing lists