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

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
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -470,6 +470,7 @@ static int tpm_key_encrypt(struct tpm_key *tk,
	if (ret < 0)
		goto error_free_tfm;

	ret = -ENOMEM;
	req = akcipher_request_alloc(tfm, GFP_KERNEL);
	if (!req)
		goto error_free_tfm;
+1 −0
Original line number Diff line number Diff line
@@ -184,6 +184,7 @@ static int software_key_eds_op(struct kernel_pkey_params *params,
	if (IS_ERR(tfm))
		return PTR_ERR(tfm);

	ret = -ENOMEM;
	req = akcipher_request_alloc(tfm, GFP_KERNEL);
	if (!req)
		goto error_free_tfm;