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

Re: [Xen-devel] Xen-unstable, stubdom causes hypervisor crash



At 18:04 +0200 on 20 May (1432145043), Roger Pau Monné wrote:
> El 20/05/15 a les 17.59, Jan Beulich ha escrit:
> >>>> On 20.05.15 at 17:45, <andrew.cooper3@xxxxxxxxxx> wrote:
> >> Try this:  It appears that vfree(NULL) isn't safe.
> >
> > And intentionally so (I think this was even mentioned while discussing
> > the patch), matching vunmap().
> 
> Yes, but previous versions of vfree where able to cope with NULL. The
> following fixes the callers:

I'd much rather make vfree(NULL) safe than add guards to all its
callers.

Tim.

> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
> ---
> diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c
> index cea7990..0316b59 100644
> --- a/xen/arch/x86/mm/hap/hap.c
> +++ b/xen/arch/x86/mm/hap/hap.c
> @@ -174,7 +174,8 @@ int hap_track_dirty_vram(struct domain *d,
>                                    p2m_ram_logdirty, p2m_ram_rw);
>      }
>  out:
> -    vfree(dirty_bitmap);
> +    if ( dirty_bitmap )
> +        vfree(dirty_bitmap);
> 
>      return rc;
>  }
> diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c
> index 9e9d19f..88e0f7e 100644
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -3707,7 +3707,8 @@ out:
>          paging_unlock(d);
>          rc = -EFAULT;
>      }
> -    vfree(dirty_bitmap);
> +    if ( dirty_bitmap )
> +        vfree(dirty_bitmap);
>      p2m_unlock(p2m_get_hostp2m(d));
>      return rc;
>  }
> 
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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