Skip to contentSkip to conversation

Fix x86 iounmap() calling ioremap_change_attr() with a size that's too big.

PATCH New Loic Prylli 1 participant 1 message Dec 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix x86 iounmap() calling ioremap_change_attr() with a size that's too big.

The get_vm_area() allocates one extra guard page, and stores the augmented size in area->size. But the ioremap/iounmap code on x86 relies on finding the original size in area->size (otherwise it does change the attribute of some random device in the linear-map by using a wrong size in ioremap_change_attr() ). The problem is avoided by not using an extra guard page for VM_IOREMAP allocations (if somebody can think of an easy way to store the original size across ioremap()/iounmap() calls, that could be a more elegant solution).

---
 mm/vmalloc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
mm/vmalloc.c +3 -2
index af77e17..efd0093 100644
@@ -196,9 +196,10 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long fl
 		return NULL;
 
 	/*
-	 * We always allocate a guard page.
+	 * We allocate a guard page (except for ioremap() which relies on area->size == size)
 	 */
-	size += PAGE_SIZE;
+	if (!(flags & VM_IOREMAP))
+	    size += PAGE_SIZE;
 
 	write_lock(&vmlist_lock);
 	for (p = &vmlist; (tmp = *p) != NULL ;p = &tmp->next) {
Signature · 1 line
1.5.2.2