ia64/xen-unstable
changeset 14342:2d4df044d7de
xen/x86: add allocation success checks.
The necessary fix to arch_domain_create() was discovered by Gerd
Hoffmann, but apparently not submitted so far.
Also, adjust two error codes.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
The necessary fix to arch_domain_create() was discovered by Gerd
Hoffmann, but apparently not submitted so far.
Also, adjust two error codes.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
author | kfraser@localhost.localdomain |
---|---|
date | Fri Mar 09 18:32:20 2007 +0000 (2007-03-09) |
parents | 818da23b7571 |
children | ca7cd6752cc2 |
files | xen/arch/x86/domain.c xen/arch/x86/domctl.c |
line diff
1.1 --- a/xen/arch/x86/domain.c Fri Mar 09 18:30:52 2007 +0000 1.2 +++ b/xen/arch/x86/domain.c Fri Mar 09 18:32:20 2007 +0000 1.3 @@ -457,8 +457,10 @@ int arch_domain_create(struct domain *d) 1.4 fail: 1.5 free_xenheap_page(d->shared_info); 1.6 #ifdef __x86_64__ 1.7 - free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2)); 1.8 - free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3)); 1.9 + if ( d->arch.mm_perdomain_l2 ) 1.10 + free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2)); 1.11 + if ( d->arch.mm_perdomain_l3 ) 1.12 + free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3)); 1.13 #endif 1.14 free_xenheap_pages(d->arch.mm_perdomain_pt, pdpt_order); 1.15 return rc;
2.1 --- a/xen/arch/x86/domctl.c Fri Mar 09 18:30:52 2007 +0000 2.2 +++ b/xen/arch/x86/domctl.c Fri Mar 09 18:32:20 2007 +0000 2.3 @@ -145,6 +145,12 @@ long arch_do_domctl( 2.4 } 2.5 2.6 arr32 = alloc_xenheap_page(); 2.7 + if ( !arr32 ) 2.8 + { 2.9 + ret = -ENOMEM; 2.10 + put_domain(d); 2.11 + break; 2.12 + } 2.13 2.14 ret = 0; 2.15 for ( n = 0; n < num; ) 2.16 @@ -157,7 +163,7 @@ long arch_do_domctl( 2.17 domctl->u.getpageframeinfo2.array, 2.18 n, k) ) 2.19 { 2.20 - ret = -EINVAL; 2.21 + ret = -EFAULT; 2.22 break; 2.23 } 2.24 2.25 @@ -201,7 +207,7 @@ long arch_do_domctl( 2.26 if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array, 2.27 n, arr32, k) ) 2.28 { 2.29 - ret = -EINVAL; 2.30 + ret = -EFAULT; 2.31 break; 2.32 } 2.33