From: Tim Deegan <tim@xen.org>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Wei Liu <wei.liu2@citrix.com>, Jan Beulich <JBeulich@suse.com>,
xen-devel@lists.xenproject.org
Subject: Re: Xen-unstable, stubdom causes hypervisor crash
Date: Wed, 20 May 2015 17:25:47 +0100 [thread overview]
Message-ID: <20150520162547.GD12015@deinos.phlegethon.org> (raw)
In-Reply-To: <555CB073.3040705@citrix.com>
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@citrix.com> 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@citrix.com>
> ---
> 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;
> }
>
>
prev parent reply other threads:[~2015-05-20 16:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 15:39 Xen-unstable, stubdom causes hypervisor crash Wei Liu
2015-05-20 15:43 ` Andrew Cooper
2015-05-20 15:45 ` Andrew Cooper
2015-05-20 15:52 ` Wei Liu
2015-05-20 15:59 ` Jan Beulich
2015-05-20 16:03 ` Andrew Cooper
2015-05-20 16:04 ` Roger Pau Monné
2015-05-20 16:25 ` Tim Deegan [this message]
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=20150520162547.GD12015@deinos.phlegethon.org \
--to=tim@xen.org \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/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.