]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
KVM: Disable interrupts around get_kernel_ns()
authorAvi Kivity <avi@redhat.com>
Mon, 4 Oct 2010 10:55:49 +0000 (12:55 +0200)
committerAvi Kivity <avi@redhat.com>
Mon, 4 Oct 2010 10:55:49 +0000 (12:55 +0200)
get_kernel_ns() wants preemption disabled.  It doesn't make a lot of sense
during the get/set ioctls (no way to make them non-racy) but the callee wants
it.

Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index 3729bcbc916896ddf09845b2e0f23fd0523c50f8..899acbbfeb2040d9192645e5fad0403e2bb7fa1b 100644 (file)
@@ -3469,8 +3469,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
                        goto out;
 
                r = 0;
+               local_irq_disable();
                now_ns = get_kernel_ns();
                delta = user_ns.clock - now_ns;
+               local_irq_enable();
                kvm->arch.kvmclock_offset = delta;
                break;
        }
@@ -3478,8 +3480,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
                struct kvm_clock_data user_ns;
                u64 now_ns;
 
+               local_irq_disable();
                now_ns = get_kernel_ns();
                user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
+               local_irq_enable();
                user_ns.flags = 0;
 
                r = -EFAULT;