]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
mm: disallow MEMF_no_refcount to be passed for domain-owned allocations
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Nov 2018 11:08:09 +0000 (12:08 +0100)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Nov 2018 11:08:09 +0000 (12:08 +0100)
When such pages get assigned to domains (and hence their ->tot_pages
not incremented accordingly) we would otherwise also need to suppress
decrementing the count when freeing those pages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/common/page_alloc.c

index 08ee8cfbb9e514c4b7e3fbc5fd62ea8c975c28bf..4a2cbda1dbff22a0297a6edbda708d9d2059497c 100644 (file)
@@ -2303,6 +2303,11 @@ struct page_info *alloc_domheap_pages(
 
     if ( memflags & MEMF_no_owner )
         memflags |= MEMF_no_refcount;
+    else if ( (memflags & MEMF_no_refcount) && d )
+    {
+        ASSERT(!(memflags & MEMF_no_refcount));
+        return NULL;
+    }
 
     if ( dma_bitsize && ((dma_zone = bits_to_zone(dma_bitsize)) < zone_hi) )
         pg = alloc_heap_pages(dma_zone + 1, zone_hi, order, memflags, d);