Message ID | 1386469952-21744-1-git-send-email-julien.grall@linaro.org |
---|---|
State | Accepted |
Headers | show |
On Sun, 8 Dec 2013, Julien Grall wrote: > 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> > xen/arch/arm/domain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c > index 52d2403..67c65c3 100644 > --- a/xen/arch/arm/domain.c > +++ b/xen/arch/arm/domain.c > @@ -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; > > -- > 1.7.10.4 >
On Sun, 2013-12-08 at 15:15 +0000, Stefano Stabellini wrote: > On Sun, 8 Dec 2013, Julien Grall wrote: > > 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> + applied, thanks. Ian.
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 52d2403..67c65c3 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -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;
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> --- xen/arch/arm/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)