[patch] Re: Bug in vmalloc?

Andrea Arcangeli (andrea@e-mind.com)
Mon, 5 Oct 1998 15:49:50 +0200 (CEST)


On Mon, 5 Oct 1998, Neil Booth wrote:

>Moreover, vfree calls vmfree_area_pages with this larger size:-
>
>void vfree(void * addr)
>{
> .
> .
> vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);

Trying to free an additional page doesn' t cause problems since
free_area_pmd() and free_area_pte() are smart enough to handle null
pmd/pte.

But yes the right thing to do is this:

--- linux/mm/vmalloc.c Sat Aug 8 15:19:49 1998
+++ /tmp/vmalloc.c Mon Oct 5 15:38:15 1998
@@ -186,7 +186,8 @@
for (p = &vmlist ; (tmp = *p) ; p = &tmp->next) {
if (tmp->addr == addr) {
*p = tmp->next;
- vmfree_area_pages(VMALLOC_VMADDR(tmp->addr), tmp->size);
+ vmfree_area_pages(VMALLOC_VMADDR(tmp->addr),
+ tmp->size - PAGE_SIZE);
kfree(tmp);
return;
}

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/