From: Jan Beulich Date: Thu, 6 Dec 2012 13:19:15 +0000 (+0100) Subject: memop: adjust error checking in populate_physmap() X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~7558 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=8e4addea279da7430d80514828f49013979117e6;p=xen.git memop: adjust error checking in populate_physmap() Checking that multi-page allocations are permitted is unnecessary for PoD population operations. Instead, the (loop invariant) check added for addressing XSA-31 can be moved here. Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- diff --git a/xen/common/memory.c b/xen/common/memory.c index a076f81afe..a88348f802 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -99,7 +99,8 @@ static void populate_physmap(struct memop_args *a) a->nr_extents-1) ) return; - if ( !multipage_allocation_permitted(current->domain, a->extent_order) ) + if ( a->memflags & MEMF_populate_on_demand ? a->extent_order > MAX_ORDER : + !multipage_allocation_permitted(current->domain, a->extent_order) ) return; for ( i = a->nr_done; i < a->nr_extents; i++ ) @@ -115,8 +116,7 @@ static void populate_physmap(struct memop_args *a) if ( a->memflags & MEMF_populate_on_demand ) { - if ( a->extent_order > MAX_ORDER || - guest_physmap_mark_populate_on_demand(d, gpfn, + if ( guest_physmap_mark_populate_on_demand(d, gpfn, a->extent_order) < 0 ) goto out; }