aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-11-28 07:18:47 -0500
committerAvi Kivity <avi@redhat.com>2009-12-03 02:32:26 -0500
commit3548bab501887a698a887639b54d5ecaf35c387b (patch)
tree5c04b0a64d680c08df6286e4348c4bfd1b73f76a /arch/x86/kvm
parent046d87103addc117f0d397196e85189722d4d7de (diff)
KVM: Drop user return notifier when disabling virtualization on a cpu
This way, we don't leave a dangling notifier on cpu hotunplug or module unload. In particular, module unload leaves the notifier pointing into freed memory. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/x86.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 35eea30821d6..106f9f1f78c0 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -201,6 +201,14 @@ void kvm_set_shared_msr(unsigned slot, u64 value)
201} 201}
202EXPORT_SYMBOL_GPL(kvm_set_shared_msr); 202EXPORT_SYMBOL_GPL(kvm_set_shared_msr);
203 203
204static void drop_user_return_notifiers(void *ignore)
205{
206 struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs);
207
208 if (smsr->registered)
209 kvm_on_user_return(&smsr->urn);
210}
211
204unsigned long segment_base(u16 selector) 212unsigned long segment_base(u16 selector)
205{ 213{
206 struct descriptor_table gdt; 214 struct descriptor_table gdt;
@@ -5004,6 +5012,7 @@ int kvm_arch_hardware_enable(void *garbage)
5004void kvm_arch_hardware_disable(void *garbage) 5012void kvm_arch_hardware_disable(void *garbage)
5005{ 5013{
5006 kvm_x86_ops->hardware_disable(garbage); 5014 kvm_x86_ops->hardware_disable(garbage);
5015 drop_user_return_notifiers(garbage);
5007} 5016}
5008 5017
5009int kvm_arch_hardware_setup(void) 5018int kvm_arch_hardware_setup(void)