Thread (3 messages) 3 messages, 3 authors, 2017-02-10
STALE3519d

[PATCH -next] crypto: asymmetric_keys - Fix error return code on failure

From: Wei Yongjun <hidden>
Date: 2017-02-09 15:57:30
Subsystem: asymmetric keys, crypto api, the rest · Maintainers: David Howells, Lukas Wunner, Ignat Korchagin, Herbert Xu, "David S. Miller", Linus Torvalds

From: Wei Yongjun <redacted>

Fix to return error code -ENOMEM from the akcipher_request_alloc()
error handling case instead of 0.

Signed-off-by: Wei Yongjun <redacted>
---
 crypto/asymmetric_keys/public_key.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/public_key.c
index 3a23274..3131bba 100644
--- a/crypto/asymmetric_keys/public_key.c
+++ b/crypto/asymmetric_keys/public_key.c
@@ -184,8 +184,10 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
 		return PTR_ERR(tfm);
 
 	req = akcipher_request_alloc(tfm, GFP_KERNEL);
-	if (!req)
+	if (!req) {
+		ret = -ENOMEM;
 		goto error_free_tfm;
+	}
 
 	if (pkey->key_is_private)
 		ret = crypto_akcipher_set_priv_key(tfm,
@@ -268,8 +270,10 @@ int public_key_verify_signature(const struct public_key *pkey,
 		return PTR_ERR(tfm);
 
 	req = akcipher_request_alloc(tfm, GFP_KERNEL);
-	if (!req)
+	if (!req) {
+		ret = -ENOMEM;
 		goto error_free_tfm;
+	}
 
 	if (pkey->key_is_private)
 		ret = crypto_akcipher_set_priv_key(tfm,
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help