[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] incorrect xfree for mini-os
xfree in extras/mini-os/lib/xmalloc.c is incorrect. It has to check first if the memory to free is so big as to be freed directly by free_pages. mini-os domains crash without this patch if they don't configure vfb correctly. Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@xxxxxxxxxxxxxx> diff -r db943e8d1051 extras/mini-os/lib/xmalloc.c --- a/extras/mini-os/lib/xmalloc.c Tue Apr 01 10:09:33 2008 +0100 +++ b/extras/mini-os/lib/xmalloc.c Wed Apr 02 19:34:40 2008 +0900 @@ -208,6 +208,13 @@ void xfree(const void *p) pad = (struct xmalloc_pad *)p - 1; hdr = (struct xmalloc_hdr *)((char *)p - pad->hdr_size); + /* Big allocs free directly. */ + if ( hdr->size >= PAGE_SIZE ) + { + free_pages(hdr, get_order(hdr->size)); + return; + } + /* We know hdr will be on same page. */ if(((long)p & PAGE_MASK) != ((long)hdr & PAGE_MASK)) { @@ -220,13 +227,6 @@ void xfree(const void *p) { printk("Should not be previously freed\n"); *(int*)0=0; - } - - /* Big allocs free directly. */ - if ( hdr->size >= PAGE_SIZE ) - { - free_pages(hdr, get_order(hdr->size)); - return; } /* Merge with other free block, or put in list. */ _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |