[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <159485211858.2340757.9890754969922775496.stgit@warthog.procyon.org.uk>
Date: Wed, 15 Jul 2020 23:28:38 +0100
From: David Howells <dhowells@...hat.com>
To: torvalds@...ux-foundation.org
Cc: Wei Yongjun <weiyongjun1@...wei.com>, dhowells@...hat.com,
jarkko.sakkinen@...ux.intel.com, keyrings@...r.kernel.org,
linux-security-module@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] keys: asymmetric: fix error return code in
software_key_query()
From: Wei Yongjun <weiyongjun1@...wei.com>
Fix to return negative error code -ENOMEM from kmalloc() error handling
case instead of 0, as done elsewhere in this function.
Fixes: f1774cb8956a ("X.509: parse public key parameters from x509 for akcipher")
Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
Signed-off-by: David Howells <dhowells@...hat.com>
---
crypto/asymmetric_keys/public_key.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index d7f43d4ea925..e5fae4e838c0 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -119,6 +119,7 @@ static int software_key_query(const struct kernel_pkey_params *params,
if (IS_ERR(tfm))
return PTR_ERR(tfm);
+ ret = -ENOMEM;
key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
GFP_KERNEL);
if (!key)
Powered by blists - more mailing lists