aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorSonic Zhang <sonic.adi@gmail.com>2006-09-27 04:50:17 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-27 11:26:14 -0400
commit910e46da4b4e93d56ffea318c64afa41868d5e6d (patch)
tree67f7dd9086dcf456101c843a1e310e7090a590db /mm
parent0159b141d8b1f9b9f9cffacae47bec1e05c63b8b (diff)
[PATCH] Check if start address is in vma region in NOMMU function get_user_pages()
In NOMMU arch, if run "cat /proc/self/mem", data from physical address 0 are read. This behavior is different from MMU arch. In IA32, message "cat: /proc/self/mem: Input/output error" is reported. This issue is rootcaused by not validate the start address in NOMMU function get_user_pages(). Following patch solves this issue. Signed-off-by: Sonic Zhang <sonic.adi@gmail.com> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/nommu.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index 00ffa974c90c..2af50831183f 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -129,16 +129,20 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
129 struct page **pages, struct vm_area_struct **vmas) 129 struct page **pages, struct vm_area_struct **vmas)
130{ 130{
131 int i; 131 int i;
132 static struct vm_area_struct dummy_vma; 132 struct vm_area_struct *vma;
133 133
134 for (i = 0; i < len; i++) { 134 for (i = 0; i < len; i++) {
135 vma = find_vma(mm, start);
136 if(!vma)
137 return i ? : -EFAULT;
138
135 if (pages) { 139 if (pages) {
136 pages[i] = virt_to_page(start); 140 pages[i] = virt_to_page(start);
137 if (pages[i]) 141 if (pages[i])
138 page_cache_get(pages[i]); 142 page_cache_get(pages[i]);
139 } 143 }
140 if (vmas) 144 if (vmas)
141 vmas[i] = &dummy_vma; 145 vmas[i] = vma;
142 start += PAGE_SIZE; 146 start += PAGE_SIZE;
143 } 147 }
144 return(i); 148 return(i);