Skip to content

Commit bea3741

Browse files
ebiggersJarkko Sakkinen
authored andcommitted
KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails
No error code was being set on this error path. Cc: [email protected] Fixes: ad4b1eb ("KEYS: asym_tpm: Implement encryption operation [ver #2]") Fixes: c08fed7 ("KEYS: Implement encrypt, decrypt and sign for software asymmetric key [ver #2]") Reviewed-by: James Morris <[email protected]> Signed-off-by: Eric Biggers <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent 601f009 commit bea3741

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

crypto/asymmetric_keys/asym_tpm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,7 @@ static int tpm_key_encrypt(struct tpm_key *tk,
470470
if (ret < 0)
471471
goto error_free_tfm;
472472

473+
ret = -ENOMEM;
473474
req = akcipher_request_alloc(tfm, GFP_KERNEL);
474475
if (!req)
475476
goto error_free_tfm;

crypto/asymmetric_keys/public_key.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
184184
if (IS_ERR(tfm))
185185
return PTR_ERR(tfm);
186186

187+
ret = -ENOMEM;
187188
req = akcipher_request_alloc(tfm, GFP_KERNEL);
188189
if (!req)
189190
goto error_free_tfm;

0 commit comments

Comments
 (0)