linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nommu: remap_pfn_range: fix addr parameter check
@ 2012-09-13  2:40 Bob Liu
  2012-09-13 19:27 ` Andrew Morton
  0 siblings, 1 reply; 6+ messages in thread
From: Bob Liu @ 2012-09-13  2:40 UTC (permalink / raw)
  To: akpm
  Cc: linux-mm, bhupesh.sharma, laurent.pinchart, uclinux-dist-devel,
	linux-media, dhowells, geert, gerg, stable, gregkh, Bob Liu

The addr parameter may not page aligned eg. when it's come from
vfb_mmap():vma->vm_start in video driver.

This patch fix the check in remap_pfn_range() else some driver like v4l2 will
fail in this function while calling mmap() on nommu arch like blackfin and st.

Reported-by: Bhupesh SHARMA <bhupesh.sharma@st.com>
Reported-by: Scott Jiang <scott.jiang.linux@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
---
 mm/nommu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index d4b0c10..5d6068b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1819,7 +1819,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
 int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
 		unsigned long pfn, unsigned long size, pgprot_t prot)
 {
-	if (addr != (pfn << PAGE_SHIFT))
+	if ((addr & PAGE_MASK) != (pfn << PAGE_SHIFT))
 		return -EINVAL;
 
 	vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
-- 
1.7.9.5


--
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 related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-17  6:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-13  2:40 [PATCH] nommu: remap_pfn_range: fix addr parameter check Bob Liu
2012-09-13 19:27 ` Andrew Morton
2012-09-14  9:23   ` Scott Jiang
2012-09-14 10:15     ` Bhupesh SHARMA
2012-09-14 10:39     ` Bhupesh SHARMA
2012-09-17  6:02       ` Scott Jiang

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).