summaryrefslogtreecommitdiff
path: root/crypto
diff options
context:
space:
mode:
authorWei Yongjun <weiyongjun1@huawei.com>2020-07-16 01:28:38 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2020-07-16 01:49:04 +0300
commit6cbba1f9114a8134cff9138c79add15012fd52b9 (patch)
tree42a921ce57a612cbc1c3238304840aedb684b5aa /crypto
parent811f04bac15181a3351ef1d1aaa377954056e93b (diff)
downloadlinux-6cbba1f9114a8134cff9138c79add15012fd52b9.tar.xz
keys: asymmetric: fix error return code in software_key_query()
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> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/asymmetric_keys/public_key.c1
1 files changed, 1 insertions, 0 deletions
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)