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-changelog

[Xen-changelog] [xen-unstable] [xenstored] Fix error path when xc_map_fo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [xenstored] Fix error path when xc_map_foreign_range fails.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 02 Mar 2007 08:00:16 -0800
Delivery-date: Fri, 02 Mar 2007 07:59:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
# Date 1172834712 0
# Node ID d12432f3131110672644b5b77cf3eb2aef34378c
# Parent  139794d55898642e3f0bef2f771a83979333ee1e
[xenstored] Fix error path when xc_map_foreign_range fails.
If xc_map_foreign_range fails, the new domain object is freed,
but it is not removed from the connection list.

Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxxx>
---
 tools/xenstore/xenstored_domain.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff -r 139794d55898 -r d12432f31311 tools/xenstore/xenstored_domain.c
--- a/tools/xenstore/xenstored_domain.c Thu Mar 01 17:59:17 2007 +0000
+++ b/tools/xenstore/xenstored_domain.c Fri Mar 02 11:25:12 2007 +0000
@@ -320,6 +320,7 @@ void do_introduce(struct connection *con
        unsigned long mfn;
        evtchn_port_t port;
        int rc;
+       struct xenstore_domain_interface *interface;
 
        if (get_strings(in, vec, ARRAY_SIZE(vec)) < ARRAY_SIZE(vec)) {
                send_error(conn, EINVAL);
@@ -344,19 +345,21 @@ void do_introduce(struct connection *con
        domain = find_domain_by_domid(domid);
 
        if (domain == NULL) {
+               interface = xc_map_foreign_range(
+                       *xc_handle, domid,
+                       getpagesize(), PROT_READ|PROT_WRITE, mfn);
+               if (!interface) {
+                       send_error(conn, errno);
+                       return;
+               }
                /* Hang domain off "in" until we're finished. */
                domain = new_domain(in, domid, port);
                if (!domain) {
+                       munmap(interface, getpagesize());
                        send_error(conn, errno);
                        return;
                }
-               domain->interface = xc_map_foreign_range(
-                       *xc_handle, domid,
-                       getpagesize(), PROT_READ|PROT_WRITE, mfn);
-               if (!domain->interface) {
-                       send_error(conn, errno);
-                       return;
-               }
+               domain->interface = interface;
                domain->mfn = mfn;
 
                /* Now domain belongs to its connection. */

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [xenstored] Fix error path when xc_map_foreign_range fails., Xen patchbot-unstable <=