summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2009-11-28 12:18:47 (GMT)
committerAvi Kivity <avi@redhat.com>2009-12-03 07:32:26 (GMT)
commit3548bab501887a698a887639b54d5ecaf35c387b (patch)
tree5c04b0a64d680c08df6286e4348c4bfd1b73f76a /arch/x86
parent046d87103addc117f0d397196e85189722d4d7de (diff)
downloadlinux-fsl-qoriq-3548bab501887a698a887639b54d5ecaf35c387b.tar.xz
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')
-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 35eea30..106f9f1 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)
}
EXPORT_SYMBOL_GPL(kvm_set_shared_msr);
+static void drop_user_return_notifiers(void *ignore)
+{
+ struct kvm_shared_msrs *smsr = &__get_cpu_var(shared_msrs);
+
+ if (smsr->registered)
+ kvm_on_user_return(&smsr->urn);
+}
+
unsigned long segment_base(u16 selector)
{
struct descriptor_table gdt;
@@ -5004,6 +5012,7 @@ int kvm_arch_hardware_enable(void *garbage)
void kvm_arch_hardware_disable(void *garbage)
{
kvm_x86_ops->hardware_disable(garbage);
+ drop_user_return_notifiers(garbage);
}
int kvm_arch_hardware_setup(void)