patch-2.1.112 linux/arch/i386/mm/ioremap.c

Next file: linux/drivers/block/ide-floppy.c
Previous file: linux/arch/i386/lib/locks.S
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.111/linux/arch/i386/mm/ioremap.c linux/arch/i386/mm/ioremap.c
@@ -90,13 +90,34 @@
 	void * addr;
 	struct vm_struct * area;
 
-	if (phys_addr < virt_to_phys(high_memory))
+	/*
+	 * Don't remap the low PCI/ISA area, it's always mapped..
+	 */
+	if (phys_addr >= 0xA0000 && (phys_addr+size) <= 0x100000)
 		return phys_to_virt(phys_addr);
+
+	/*
+	 * Don't allow anybody to remap normal RAM that we're using..
+	 */
+	if (phys_addr < virt_to_phys(high_memory))
+		return NULL;
+
+	/*
+	 * Mappings have to be page-aligned
+	 */
 	if (phys_addr & ~PAGE_MASK)
 		return NULL;
 	size = PAGE_ALIGN(size);
+
+	/*
+	 * Don't allow mappings that wrap..
+	 */
 	if (!size || size > phys_addr + size)
 		return NULL;
+
+	/*
+	 * Ok, go for it..
+	 */
 	area = get_vm_area(size);
 	if (!area)
 		return NULL;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov