xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <daniel.kiper@oracle.com>
To: ian.campbell@citrix.com, ian.jackson@eu.citrix.com,
	stefano.stabellini@eu.citrix.com, xen-devel@lists.xen.org
Cc: Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH] libxenctrl: Fix xc_interface_close() crash if it gets NULL as an argument
Date: Mon,  2 Dec 2013 20:13:03 +0100	[thread overview]
Message-ID: <1386011583-29413-1-git-send-email-daniel.kiper@oracle.com> (raw)

xc_interface_close() crashes if it gets NULL as an argument. However,
it just calls xc_interface_close_common() which is called by many
others functions. It means that they are also vulnerable. So fix above
mentioned issue by adding NULL check in xc_interface_close_common().
This way we fix similar issue in other functions which calls
xc_interface_close_common() too.

Signed-off-by: Daniel Kiper <daniel.kiper@oracle.com>
---
 tools/libxc/xc_private.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 524862e..838fd21 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -198,6 +198,9 @@ static int xc_interface_close_common(xc_interface *xch)
 {
     int rc = 0;
 
+    if (!xch)
+	return 0;
+
     xc__hypercall_buffer_cache_release(xch);
 
     xtl_logger_destroy(xch->dombuild_logger_tofree);
-- 
1.7.10.4

             reply	other threads:[~2013-12-02 19:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 19:13 Daniel Kiper [this message]
2013-12-03  9:47 ` [PATCH] libxenctrl: Fix xc_interface_close() crash if it gets NULL as an argument Ian Campbell
2013-12-03 11:58   ` Daniel Kiper
2013-12-04 14:53     ` Ian Campbell

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=1386011583-29413-1-git-send-email-daniel.kiper@oracle.com \
    --to=daniel.kiper@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).