virt/sev-guest: Remove unnecessary free in init_crypto()

If the memory allocation for the auth tag fails, then there is no need
to free it.

Fixes: fce96cf044 ("virt: Add SEV-SNP guest driver")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Link: https://lore.kernel.org/r/20221018015425.887891-1-rafaelmendsr@gmail.com
This commit is contained in:
Rafael Mendonca 2022-10-17 22:54:25 -03:00 committed by Borislav Petkov
parent 9abf2313ad
commit c6fbb759d6
1 changed files with 1 additions and 3 deletions

View File

@ -152,12 +152,10 @@ static struct snp_guest_crypto *init_crypto(struct snp_guest_dev *snp_dev, u8 *k
crypto->a_len = crypto_aead_authsize(crypto->tfm);
crypto->authtag = kmalloc(crypto->a_len, GFP_KERNEL_ACCOUNT);
if (!crypto->authtag)
goto e_free_auth;
goto e_free_iv;
return crypto;
e_free_auth:
kfree(crypto->authtag);
e_free_iv:
kfree(crypto->iv);
e_free_crypto: