[PATCH] KVM: fix error handling in svm_cpu_init

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



sd->save_area should be freed in error path

Fixes: 70cd94e60c733 ("KVM: SVM: VMRUN should use associated ASID when SEV is enabled")
Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
---
 arch/x86/kvm/svm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index f13a3a24d360..1787a484d21c 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1006,17 +1006,18 @@ static int svm_cpu_init(int cpu)
 					      sizeof(void *),
 					      GFP_KERNEL);
 		if (!sd->sev_vmcbs)
-			goto err_1;
+			goto err_2;
 	}
 
 	per_cpu(svm_data, cpu) = sd;
 
 	return 0;
 
+err_2:
+	__free_page(sd->save_area);
 err_1:
 	kfree(sd);
 	return r;
-
 }
 
 static bool valid_msr_intercept(u32 index)
-- 
2.16.2




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux