linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nommu: get_user_pages(): pin last page on non-page-aligned start
@ 2010-03-02 18:29 Steven J. Magnani
  2010-03-03  3:03 ` Paul Mundt
  2010-03-08  9:38 ` David Howells
  0 siblings, 2 replies; 3+ messages in thread
From: Steven J. Magnani @ 2010-03-02 18:29 UTC (permalink / raw)
  To: linux-mm; +Cc: linux-kernel, Steven J. Magnani

The noMMU version of get_user_pages() fails to pin the last page
when the start address isn't page-aligned. The patch fixes this in a way
that makes find_extend_vma() congruent to its MMU cousin.

Signed-off-by: Steven J. Magnani <steve@digidescorp.com>
---
diff -uprN a/mm/nommu.c b/mm/nommu.c
--- a/mm/nommu.c	2010-03-01 16:37:31.000000000 -0600
+++ b/mm/nommu.c	2010-03-01 21:34:49.000000000 -0600
@@ -146,7 +146,7 @@ int __get_user_pages(struct task_struct 
 			(VM_MAYREAD | VM_MAYWRITE) : (VM_READ | VM_WRITE);
 
 	for (i = 0; i < nr_pages; i++) {
-		vma = find_vma(mm, start);
+		vma = find_extend_vma(mm, start);
 		if (!vma)
 			goto finish_or_fault;
 
@@ -764,7 +764,7 @@ EXPORT_SYMBOL(find_vma);
  */
 struct vm_area_struct *find_extend_vma(struct mm_struct *mm, unsigned long addr)
 {
-	return find_vma(mm, addr);
+	return find_vma(mm, addr & PAGE_MASK);
 }
 
 /*

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-08  9:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-02 18:29 [PATCH] nommu: get_user_pages(): pin last page on non-page-aligned start Steven J. Magnani
2010-03-03  3:03 ` Paul Mundt
2010-03-08  9:38 ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).