diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-04-02 15:32:13 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-04-02 15:32:13 +0100 |
commit | 30860b6fe5224c7922ed20adff4929547431ede1 (patch) | |
tree | 4b926036de3b3ca737d6d640e8ff66ccdff1518e /extras/mini-os/lib | |
parent | cb359ce6b112ea4c2e7becfa60b50ced2f0d8033 (diff) | |
download | xen-30860b6fe5224c7922ed20adff4929547431ede1.tar.gz xen-30860b6fe5224c7922ed20adff4929547431ede1.tar.bz2 xen-30860b6fe5224c7922ed20adff4929547431ede1.zip |
minios: Fix xfree() bug.
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
vfb is misconfigured.
Signed-off-by: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
Diffstat (limited to 'extras/mini-os/lib')
-rw-r--r-- | extras/mini-os/lib/xmalloc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/extras/mini-os/lib/xmalloc.c b/extras/mini-os/lib/xmalloc.c index d4c3941738..82d5cc61db 100644 --- a/extras/mini-os/lib/xmalloc.c +++ b/extras/mini-os/lib/xmalloc.c @@ -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)) { @@ -222,13 +229,6 @@ void xfree(const void *p) *(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. */ /* spin_lock_irqsave(&freelist_lock, flags); */ list_for_each_entry_safe( i, tmp, &freelist, freelist ) |