xen/arm: arch_domain_create: don't return 0 when alloc_xenheap_pages has failed
authorJulien Grall <julien.grall@linaro.org>
Sun, 8 Dec 2013 02:32:32 +0000 (02:32 +0000)
committerIan Campbell <ian.campbell@citrix.com>
Mon, 9 Dec 2013 09:58:55 +0000 (09:58 +0000)
The previous call before alloc_xenheap_pages reset rc to 0 if it success.
If the latter fails, arch_domain_create will return 0 and Xen will consider
the domain as valid. Move rc initialization later.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/arch/arm/domain.c

index 52d2403345579d33f68d3e85cf8dd378374b2190..67c65c3289e57de1080ced8c4e3d64a942abf4d3 100644 (file)
@@ -501,10 +501,10 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags)
     if ( is_idle_domain(d) )
         return 0;
 
-    rc = -ENOMEM;
     if ( (rc = p2m_init(d)) != 0 )
         goto fail;
 
+    rc = -ENOMEM;
     if ( (d->shared_info = alloc_xenheap_pages(0, 0)) == NULL )
         goto fail;