WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH]libxc: fix a Segmentation fault

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH]libxc: fix a Segmentation fault
From: Yang Hongyang <yanghy@xxxxxxxxxxxxxx>
Date: Mon, 28 Jun 2010 14:45:55 +0800
Delivery-date: Sun, 27 Jun 2010 23:45:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4
# xl list
xc: error: Could not obtain handle on privileged command interface (2 = No such 
file or directory): Internal error
Segmentation fault

This is because xc free the logger which xl created.

Signed-off-by: Yang Hongyang <yanghy@xxxxxxxxxxxxxx> 

diff -r b622e411eef8 tools/libxc/xc_private.c
--- a/tools/libxc/xc_private.c  Thu Jun 24 21:56:03 2010 +0100
+++ b/tools/libxc/xc_private.c  Mon Jun 28 22:48:07 2010 +0800
@@ -19,6 +19,7 @@
                                 xentoollog_logger *dombuild_logger,
                                 unsigned open_flags) {
     xc_interface xch_buf, *xch = &xch_buf;
+    int init_handler = 0;
 
     xch->fd = -1;
     xch->dombuild_logger_file = 0;
@@ -33,6 +34,7 @@
             xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
         if (!xch->error_handler)
             goto err;
+        init_handler =1;
     }
 
     xch = malloc(sizeof(*xch));
@@ -52,7 +54,7 @@
     return xch;
 
  err:
-    if (xch) xtl_logger_destroy(xch->error_handler);
+    if (xch && init_handler) xtl_logger_destroy(xch->error_handler);
     if (xch != &xch_buf) free(xch);
     return 0;
 }

-- 
Regards
Yang Hongyang

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>