Commit bea37414 authored by Eric Biggers's avatar Eric Biggers Committed by Jarkko Sakkinen

KEYS: asymmetric: return ENOMEM if akcipher_request_alloc() fails

No error code was being set on this error path.

Cc: stable@vger.kernel.org
Fixes: ad4b1eb5 ("KEYS: asym_tpm: Implement encryption operation [ver #2]")
Fixes: c08fed73 ("KEYS: Implement encrypt, decrypt and sign for software asymmetric key [ver #2]")
Reviewed-by: default avatarJames Morris <jamorris@linux.microsoft.com>
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Signed-off-by: default avatarJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
parent 601f0093
...@@ -470,6 +470,7 @@ static int tpm_key_encrypt(struct tpm_key *tk, ...@@ -470,6 +470,7 @@ static int tpm_key_encrypt(struct tpm_key *tk,
if (ret < 0) if (ret < 0)
goto error_free_tfm; goto error_free_tfm;
ret = -ENOMEM;
req = akcipher_request_alloc(tfm, GFP_KERNEL); req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (!req) if (!req)
goto error_free_tfm; goto error_free_tfm;
......
...@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params, ...@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
if (IS_ERR(tfm)) if (IS_ERR(tfm))
return PTR_ERR(tfm); return PTR_ERR(tfm);
ret = -ENOMEM;
req = akcipher_request_alloc(tfm, GFP_KERNEL); req = akcipher_request_alloc(tfm, GFP_KERNEL);
if (!req) if (!req)
goto error_free_tfm; goto error_free_tfm;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment