xen/arm: arch_domain_create: don't return 0 when alloc_xenheap_pages has failed
PATCH 1/1 xen/arm: arch_domain_create: don't return 0 when alloc_xenheap_pages has failed
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 <[email protected]>
--- xen/arch/arm/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/domain.c +1 -1
@@ -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;
Signature · 1 line
1.7.10.4
Quoted 5 lines · Julien Grall
The previous call before
alloc_xenheap_pagesreset rc to 0 if it success. If the latter fails,arch_domain_createwill return 0 and Xen will consider the domain as valid. Move rc initialization later.Signed-off-by Julien Grall <[email protected]>
Quoted 22 lines
xen/arch/arm/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/arch/arm/domain.c +1
-1@@ -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;Signature · 1 line
1.7.10.4
Quoted 9 lines · Stefano Stabellini
Quoted 5 lines · Julien Grall
The previous call before
alloc_xenheap_pagesreset rc to 0 if it success. If the latter fails,arch_domain_createwill return 0 and Xen will consider the domain as valid. Move rc initialization later.Signed-off-by Julien Grall <[email protected]>
+ applied, thanks.
Ian.