Skip to content

Commit 6cbba1f

Browse files
Wei Yongjuntorvalds
authored andcommitted
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: f1774cb ("X.509: parse public key parameters from x509 for akcipher") Signed-off-by: Wei Yongjun <[email protected]> Signed-off-by: David Howells <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 811f04b commit 6cbba1f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

crypto/asymmetric_keys/public_key.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ static int software_key_query(const struct kernel_pkey_params *params,
119119
if (IS_ERR(tfm))
120120
return PTR_ERR(tfm);
121121

122+
ret = -ENOMEM;
122123
key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen,
123124
GFP_KERNEL);
124125
if (!key)

0 commit comments

Comments
 (0)