summaryrefslogtreecommitdiff
path: root/virt/kvm/kvm_main.c
diff options
context:
space:
mode:
authorAndrea Arcangeli <andrea@qumranet.com>2008-01-30 19:57:35 +0100
committerAvi Kivity <avi@qumranet.com>2008-04-27 11:53:18 +0300
commit0aac03f07b37da96e00371e66973d5ffaae578a4 (patch)
treef744219287c43ea0ff356cd84baa206a43fd903f /virt/kvm/kvm_main.c
parent31bb117eb48f2629e030ca547ca89a1c34150183 (diff)
downloadlwn-0aac03f07b37da96e00371e66973d5ffaae578a4.tar.gz
lwn-0aac03f07b37da96e00371e66973d5ffaae578a4.zip
KVM: Disable pagefaults during copy_from_user_inatomic()
With CONFIG_PREEMPT=n, this is needed in order to disable the fault-in code from sleeping. Signed-off-by: Andrea Arcangeli <andrea@qumranet.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'virt/kvm/kvm_main.c')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 7972e3aa2cae..cf6df5167af6 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -554,7 +554,9 @@ int kvm_read_guest_atomic(struct kvm *kvm, gpa_t gpa, void *data,
addr = gfn_to_hva(kvm, gfn);
if (kvm_is_error_hva(addr))
return -EFAULT;
+ pagefault_disable();
r = __copy_from_user_inatomic(data, (void __user *)addr + offset, len);
+ pagefault_enable();
if (r)
return -EFAULT;
return 0;