From: Eric Biggers <ebiggers@kernel.org>
To: keyrings@vger.kernel.org
Subject: [PATCH RESEND] KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails
Date: Wed, 09 Oct 2019 23:03:49 +0000 [thread overview]
Message-ID: <20191009230349.127215-1-ebiggers@kernel.org> (raw)
In-Reply-To: <20190529210132.120114-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
No error code was being set on this error path.
Fixes: ad4b1eb5fb33 ("KEYS: asym_tpm: Implement encryption operation [ver #2]")
Fixes: c08fed737126 ("KEYS: Implement encrypt, decrypt and sign for software asymmetric key [ver #2]")
Reviewed-by: James Morris <jamorris@linux.microsoft.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
crypto/asymmetric_keys/asym_tpm.c | 1 +
crypto/asymmetric_keys/public_key.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/crypto/asymmetric_keys/asym_tpm.c b/crypto/asymmetric_keys/asym_tpm.c
index 76d2ce3a1b5b1..5154e280ada22 100644
--- a/crypto/asymmetric_keys/asym_tpm.c
+++ b/crypto/asymmetric_keys/asym_tpm.c
@@ -486,6 +486,7 @@ static int tpm_key_encrypt(struct tpm_key *tk,
if (ret < 0)
goto error_free_tfm;
+ ret = -ENOMEM;
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (!req)
goto error_free_tfm;
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 364b9df9d631f..d7f43d4ea925a 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
if (IS_ERR(tfm))
return PTR_ERR(tfm);
+ ret = -ENOMEM;
req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (!req)
goto error_free_tfm;
--
2.23.0.581.g78d2f28ef7-goog
next prev parent reply other threads:[~2019-10-09 23:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-29 21:01 [PATCH RESEND] KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails Eric Biggers
2019-05-29 21:48 ` James Morris
2019-08-22 15:35 ` Eric Biggers
2019-10-09 23:03 ` Eric Biggers [this message]
2019-10-14 19:48 ` Jarkko Sakkinen
2019-11-11 18:20 ` Eric Biggers
2019-11-12 20:09 ` Jarkko Sakkinen
2019-12-09 20:19 ` Eric Biggers
2019-12-12 21:46 ` Jarkko Sakkinen
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=20191009230349.127215-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=keyrings@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: link
Be 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.