aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2007-11-14 19:59:33 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 21:45:39 -0500
commit5b23dbe8173c212d6a326e35347b038705603d39 (patch)
treea971d3cbab8911e7cbd5bec66f50d093f3f45976 /include/linux
parent19cd7537bdae6685c31677a01e08850612ba87f6 (diff)
hugetlb: follow_hugetlb_page() for write access
When calling get_user_pages(), a write flag is passed in by the caller to indicate if write access is required on the faulted-in pages. Currently, follow_hugetlb_page() ignores this flag and always faults pages for read-only access. This can cause data corruption because a device driver that calls get_user_pages() with write set will not expect COW faults to occur on the returned pages. This patch passes the write flag down to follow_hugetlb_page() and makes sure hugetlb_fault() is called with the right write_access parameter. [ezk@cs.sunysb.edu: build fix] Signed-off-by: Adam Litke <agl@us.ibm.com> Reviewed-by: Ken Chen <kenchen@google.com> Cc: David Gibson <hermes@gibson.dropbear.id.au> Cc: William Lee Irwin III <wli@holomorphy.com> Cc: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hugetlb.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
index ea0f50bfbe03..e22368656b38 100644
--- a/include/linux/hugetlb.h
+++ b/include/linux/hugetlb.h
@@ -19,7 +19,7 @@ static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 19int hugetlb_sysctl_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *); 20int hugetlb_treat_movable_handler(struct ctl_table *, int, struct file *, void __user *, size_t *, loff_t *);
21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *); 21int copy_hugetlb_page_range(struct mm_struct *, struct mm_struct *, struct vm_area_struct *);
22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int); 22int follow_hugetlb_page(struct mm_struct *, struct vm_area_struct *, struct page **, struct vm_area_struct **, unsigned long *, int *, int, int);
23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 23void unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long); 24void __unmap_hugepage_range(struct vm_area_struct *, unsigned long, unsigned long);
25int hugetlb_prefault(struct address_space *, struct vm_area_struct *); 25int hugetlb_prefault(struct address_space *, struct vm_area_struct *);
@@ -106,7 +106,7 @@ static inline unsigned long hugetlb_total_pages(void)
106 return 0; 106 return 0;
107} 107}
108 108
109#define follow_hugetlb_page(m,v,p,vs,a,b,i) ({ BUG(); 0; }) 109#define follow_hugetlb_page(m,v,p,vs,a,b,i,w) ({ BUG(); 0; })
110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL) 110#define follow_huge_addr(mm, addr, write) ERR_PTR(-EINVAL)
111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; }) 111#define copy_hugetlb_page_range(src, dst, vma) ({ BUG(); 0; })
112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; }) 112#define hugetlb_prefault(mapping, vma) ({ BUG(); 0; })