[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] minios: Fix xfree() bug.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1207146733 -3600
# Node ID 6c83e17c6e896ca768dc36c2590ec593926d61a5
# Parent  b89a5d046aa73918a6fb41a948357d73cbc54bb2
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@xxxxxxxxxxxxxx>
---
 extras/mini-os/lib/xmalloc.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff -r b89a5d046aa7 -r 6c83e17c6e89 extras/mini-os/lib/xmalloc.c
--- a/extras/mini-os/lib/xmalloc.c      Wed Apr 02 15:30:26 2008 +0100
+++ b/extras/mini-os/lib/xmalloc.c      Wed Apr 02 15:32:13 2008 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.