aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-11-28 07:53:15 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2012-11-28 19:04:58 -0500
commite6c7d32172f10b68fa9a3be05aa1231352a52171 (patch)
tree112c643ad9c04f31f654c31f218ad38cb31e08d1
parent859f8450d8a334a7f7cb994e4676cf918deff832 (diff)
KVM: VMX: fix invalid cpu passed to smp_call_function_single
In loaded_vmcs_clear, loaded_vmcs->cpu is the fist parameter passed to smp_call_function_single, if the target cpu is downing (doing cpu hot remove), loaded_vmcs->cpu can become -1 then -1 is passed to smp_call_function_single It can be triggered when vcpu is being destroyed, loaded_vmcs_clear is called in the preemptionable context Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/vmx.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index bb18923bf632..4406374e3b6d 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -1007,9 +1007,11 @@ static void __loaded_vmcs_clear(void *arg)
1007 1007
1008static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs) 1008static void loaded_vmcs_clear(struct loaded_vmcs *loaded_vmcs)
1009{ 1009{
1010 if (loaded_vmcs->cpu != -1) 1010 int cpu = loaded_vmcs->cpu;
1011 smp_call_function_single( 1011
1012 loaded_vmcs->cpu, __loaded_vmcs_clear, loaded_vmcs, 1); 1012 if (cpu != -1)
1013 smp_call_function_single(cpu,
1014 __loaded_vmcs_clear, loaded_vmcs, 1);
1013} 1015}
1014 1016
1015static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx) 1017static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx)