linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: nommu: fix remap_pfn_range()
@ 2011-05-27  3:50 Bob Liu
  2011-05-27 22:09 ` Andrew Morton
  2011-05-27 22:12 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Bob Liu @ 2011-05-27  3:50 UTC (permalink / raw)
  To: akpm; +Cc: gerg, dhowells, lethal, geert, vapier, linux-mm, Bob Liu

remap_pfn_range() does not update vma->end on no mmu arch which will
cause munmap() fail because it can't match the vma.

eg. fb_mmap() in fbmem.c will call io_remap_pfn_range() which is
remap_pfn_range() on nommu arch, if an address is not page aligned vma->start
will be changed in remap_pfn_range(), but neither size nor vma->end will be
updated. Then munmap(start, len) can't find the vma to free, because it need to
compare (start + len) with vma->end.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 mm/nommu.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 1fd0c51..829848a 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1817,6 +1817,7 @@ int remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
 		unsigned long to, unsigned long size, pgprot_t prot)
 {
 	vma->vm_start = vma->vm_pgoff << PAGE_SHIFT;
+	vma->vm_end = vma->vm_start + size;
 	return 0;
 }
 EXPORT_SYMBOL(remap_pfn_range);
-- 
1.6.3.3


--
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/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2011-06-02  6:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-27  3:50 [PATCH] mm: nommu: fix remap_pfn_range() Bob Liu
2011-05-27 22:09 ` Andrew Morton
2011-06-02  6:19   ` Bob Liu
2011-05-27 22:12 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox