[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] 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@xxxxxxxxxx> Index: 2007-02-20/xen/arch/x86/domain.c =================================================================== --- 2007-02-20.orig/xen/arch/x86/domain.c 2007-03-08 10:48:03.000000000 +0100 +++ 2007-02-20/xen/arch/x86/domain.c 2007-03-08 10:38:09.000000000 +0100 @@ -457,8 +457,10 @@ int arch_domain_create(struct domain *d) fail: free_xenheap_page(d->shared_info); #ifdef __x86_64__ - free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2)); - free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3)); + if ( d->arch.mm_perdomain_l2 ) + free_domheap_page(virt_to_page(d->arch.mm_perdomain_l2)); + if ( d->arch.mm_perdomain_l3 ) + free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3)); #endif free_xenheap_pages(d->arch.mm_perdomain_pt, pdpt_order); return rc; Index: 2007-02-20/xen/arch/x86/domctl.c =================================================================== --- 2007-02-20.orig/xen/arch/x86/domctl.c 2007-03-08 10:48:03.000000000 +0100 +++ 2007-02-20/xen/arch/x86/domctl.c 2007-03-08 10:31:29.000000000 +0100 @@ -145,6 +145,12 @@ _long arch_do_domctl( } arr32 = alloc_xenheap_page(); + if ( !arr32 ) + { + ret = -ENOMEM; + put_domain(d); + break; + } ret = 0; for ( n = 0; n < num; ) @@ -157,7 +163,7 @@ _long arch_do_domctl( domctl->u.getpageframeinfo2.array, n, k) ) { - ret = -EINVAL; + ret = -EFAULT; break; } @@ -201,7 +207,7 @@ _long arch_do_domctl( if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array, n, arr32, k) ) { - ret = -EINVAL; + ret = -EFAULT; break; } _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |