All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: INAKOSHI Hiroya <inakoshi.hiroya@jp.fujitsu.com>
Cc: xen-devel@lists.xensource.com
Subject: Re: [PATCH] incorrect xfree for mini-os
Date: Wed, 2 Apr 2008 11:52:48 +0100	[thread overview]
Message-ID: <20080402105248.GE4618@implementation.uk.xensource.com> (raw)
In-Reply-To: <47F36351.4040106@jp.fujitsu.com>

INAKOSHI Hiroya, le Wed 02 Apr 2008 19:43:29 +0900, a écrit :
> 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@jp.fujitsu.com>

Acked-by: Samuel Thibault <samuel.thibault@eu.citrix.com>

> 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@lists.xensource.com
> http://lists.xensource.com/xen-devel


-- 
Samuel
* x remarque qu'avec un peu de volonté, on peut faire du code de porc
dans d'importe quel langage Turing-complet
 -+- x sur #ens-mim - codons porc -+-

  reply	other threads:[~2008-04-02 10:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 10:43 [PATCH] incorrect xfree for mini-os INAKOSHI Hiroya
2008-04-02 10:52 ` Samuel Thibault [this message]
2008-04-02 14:45   ` Keir Fraser
2008-04-02 21:40     ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080402105248.GE4618@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=inakoshi.hiroya@jp.fujitsu.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.