Commit 395c6b0a authored by Avi Kivity's avatar Avi Kivity

KVM: Disable interrupts around get_kernel_ns()

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: default avatarAvi Kivity <avi@redhat.com>
parent 7ebaf15e
...@@ -3469,8 +3469,10 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3469,8 +3469,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
goto out; goto out;
r = 0; r = 0;
local_irq_disable();
now_ns = get_kernel_ns(); now_ns = get_kernel_ns();
delta = user_ns.clock - now_ns; delta = user_ns.clock - now_ns;
local_irq_enable();
kvm->arch.kvmclock_offset = delta; kvm->arch.kvmclock_offset = delta;
break; break;
} }
...@@ -3478,8 +3480,10 @@ long kvm_arch_vm_ioctl(struct file *filp, ...@@ -3478,8 +3480,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
struct kvm_clock_data user_ns; struct kvm_clock_data user_ns;
u64 now_ns; u64 now_ns;
local_irq_disable();
now_ns = get_kernel_ns(); now_ns = get_kernel_ns();
user_ns.clock = kvm->arch.kvmclock_offset + now_ns; user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
local_irq_enable();
user_ns.flags = 0; user_ns.flags = 0;
r = -EFAULT; r = -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment