aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorNguyen Anh Quynh <aquynh@gmail.com>2007-07-11 07:30:54 -0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 04:18:17 -0400
commitcd0d91379776cb6850c7b11c0a8843ca75967558 (patch)
tree6d1ed1d34a2642766bc870ba4563e85d4aebdd91 /drivers
parent81fe96bde7db24c02adf245604f073ea9e8d941a (diff)
KVM: Fix *nopage() in kvm_main.c
*nopage() in kvm_main.c should only store the type of mmap() fault if the pointers are not NULL. This patch fixes the problem. Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/kvm/kvm_main.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index cd0557954e50..36a458f13ec4 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -2285,7 +2285,6 @@ static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
2285 unsigned long pgoff; 2285 unsigned long pgoff;
2286 struct page *page; 2286 struct page *page;
2287 2287
2288 *type = VM_FAULT_MINOR;
2289 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; 2288 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
2290 if (pgoff == 0) 2289 if (pgoff == 0)
2291 page = virt_to_page(vcpu->run); 2290 page = virt_to_page(vcpu->run);
@@ -2294,6 +2293,9 @@ static struct page *kvm_vcpu_nopage(struct vm_area_struct *vma,
2294 else 2293 else
2295 return NOPAGE_SIGBUS; 2294 return NOPAGE_SIGBUS;
2296 get_page(page); 2295 get_page(page);
2296 if (type != NULL)
2297 *type = VM_FAULT_MINOR;
2298
2297 return page; 2299 return page;
2298} 2300}
2299 2301
@@ -2768,12 +2770,14 @@ static struct page *kvm_vm_nopage(struct vm_area_struct *vma,
2768 unsigned long pgoff; 2770 unsigned long pgoff;
2769 struct page *page; 2771 struct page *page;
2770 2772
2771 *type = VM_FAULT_MINOR;
2772 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; 2773 pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff;
2773 page = gfn_to_page(kvm, pgoff); 2774 page = gfn_to_page(kvm, pgoff);
2774 if (!page) 2775 if (!page)
2775 return NOPAGE_SIGBUS; 2776 return NOPAGE_SIGBUS;
2776 get_page(page); 2777 get_page(page);
2778 if (type != NULL)
2779 *type = VM_FAULT_MINOR;
2780
2777 return page; 2781 return page;
2778} 2782}
2779 2783