Skip to contentSkip to conversation

fix bogon in /dev/mem mmap'ing on nommu

PATCH In review Benjamin Herrenschmidt 2 participants 2 messages Apr 12, 2007 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix bogon in /dev/mem mmap'ing on nommu

While digging through my MAP_FIXED changes, I found that rather obvious bug in /dev/mem mmap implementation for nommu archs. get_unmapped_area() is expected to return an address, not a pfn.

---

I suppose that can go in anytime, and probably in stable too, Dave ?

drivers/char/mem.c +1 -1
Index: linux-cell/drivers/char/mem.c
===================================================================
@@ -248,7 +248,7 @@ static unsigned long get_unmapped_area_m
 {
 	if (!valid_mmap_phys_addr_range(pgoff, len))
 		return (unsigned long) -EINVAL;
-	return pgoff;
+	return pgoff << PAGE_SHIFT;
 }
 
 /* can't do an in-place private mapping if there's no MMU */
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Benjamin Herrenschmidt

While digging through my MAP_FIXED changes, I found that rather obvious bug in /dev/mem mmap implementation for nommu archs. get_unmapped_area() is expected to return an address, not a pfn.