linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] keys: asymmetric: fix error return code in software_key_query()
@ 2020-07-15 22:28 David Howells
  2020-07-23  1:32 ` Jarkko Sakkinen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: David Howells @ 2020-07-15 22:28 UTC (permalink / raw)
  To: torvalds
  Cc: Wei Yongjun, dhowells, jarkko.sakkinen, keyrings,
	linux-security-module, linux-kernel

From: Wei Yongjun <weiyongjun1@huawei.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@huawei.com>
Signed-off-by: David Howells <dhowells@redhat.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)



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-24  7:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 22:28 [PATCH] keys: asymmetric: fix error return code in software_key_query() David Howells
2020-07-23  1:32 ` Jarkko Sakkinen
2020-07-23  1:36   ` Jarkko Sakkinen
2020-07-23  7:31 ` David Howells
2020-07-23  7:42 ` David Howells
2020-07-24  7:16   ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).