Skip to contentSkip to conversation

KEYS: asymmetric: fix error return code in software_key_query()

PATCH New Wei Yongjun 1 participant 1 message Jun 22, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 crypto/asymmetric_keys/public_key.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
crypto/asymmetric_keys/public_key.c +1 -0
index d7f43d4ea925..c15bde024b4c 100644
@@ -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)