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

[Xen-changelog] [xen-unstable] [xenstored] Fix error path when xc_map_foreign_range fails.



# 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


 


Rackspace

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