[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200911110730.24238-1-colin.king@canonical.com>
Date: Fri, 11 Sep 2020 12:07:30 +0100
From: Colin King <colin.king@...onical.com>
To: Paolo Bonzini <pbonzini@...hat.com>,
Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org (maintainer:X86 ARCHITECTURE),
"H . Peter Anvin" <hpa@...or.com>, kvm@...r.kernel.org
Cc: kernel-janitors@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH][next] KVM: SVM: nested: fix free of uninitialized pointers save and ctl
From: Colin Ian King <colin.king@...onical.com>
Currently the error exit path to outt_set_gif will kfree on uninitialized
pointers save and ctl. Fix this by ensuring these pointers are
inintialized to NULL to avoid garbage pointer freeing.
Addresses-Coverity: ("Uninitialized pointer read")
Fixes: 6ccbd29ade0d ("KVM: SVM: nested: Don't allocate VMCB structures on stack")
Signed-off-by: Colin Ian King <colin.king@...onical.com>
---
arch/x86/kvm/svm/nested.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c
index 28036629abf8..2b15f49f9e5a 100644
--- a/arch/x86/kvm/svm/nested.c
+++ b/arch/x86/kvm/svm/nested.c
@@ -1060,8 +1060,8 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu,
struct vmcb *hsave = svm->nested.hsave;
struct vmcb __user *user_vmcb = (struct vmcb __user *)
&user_kvm_nested_state->data.svm[0];
- struct vmcb_control_area *ctl;
- struct vmcb_save_area *save;
+ struct vmcb_control_area *ctl = NULL;
+ struct vmcb_save_area *save = NULL;
int ret;
u32 cr0;
--
2.27.0
Powered by blists - more mailing lists