Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115322
b: refs/heads/master
c: 777b3f4
h: refs/heads/master
v: v3
  • Loading branch information
Marcelo Tosatti authored and Avi Kivity committed Oct 15, 2008
1 parent 4917b1c commit 1803c26
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bfadaded0dc323a1cf3f08b5068f12955b54cbaa
refs/heads/master: 777b3f49d297e387866604093b635e5bc9b9d2a6
19 changes: 12 additions & 7 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,17 +1394,22 @@ static long kvm_vm_ioctl(struct file *filp,

static int kvm_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct page *page[1];
unsigned long addr;
int npages;
gfn_t gfn = vmf->pgoff;
struct kvm *kvm = vma->vm_file->private_data;
struct page *page;

if (!kvm_is_visible_gfn(kvm, vmf->pgoff))
addr = gfn_to_hva(kvm, gfn);
if (kvm_is_error_hva(addr))
return VM_FAULT_SIGBUS;
page = gfn_to_page(kvm, vmf->pgoff);
if (is_error_page(page)) {
kvm_release_page_clean(page);

npages = get_user_pages(current, current->mm, addr, 1, 1, 0, page,
NULL);
if (unlikely(npages != 1))
return VM_FAULT_SIGBUS;
}
vmf->page = page;

vmf->page = page[0];
return 0;
}

Expand Down

0 comments on commit 1803c26

Please sign in to comment.