Skip to content

Commit 554723b

Browse files
ebiggerskelmously
authored andcommitted
KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails
BugLink: https://bugs.launchpad.net/bugs/1860490 commit bea3741 upstream. 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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Kamal Mostafa <[email protected]> Signed-off-by: Khalid Elmously <[email protected]>
1 parent 63c4fc6 commit 554723b

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
@@ -486,6 +486,7 @@ static int tpm_key_encrypt(struct tpm_key *tk,
486486
if (ret < 0)
487487
goto error_free_tfm;
488488

489+
ret = -ENOMEM;
489490
req = akcipher_request_alloc(tfm, GFP_KERNEL);
490491
if (!req)
491492
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)