]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
x86/mem_sharing: aquire extra references for pages with correct domain
authorTamas K Lengyel <tamas@tklengyel.com>
Thu, 25 Apr 2019 15:32:50 +0000 (09:32 -0600)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 13 May 2019 09:35:37 +0000 (10:35 +0100)
Patch 0502e0adae2 "x86: correct instances of PGC_allocated clearing" introduced
grabbing extra references for pages that drop references tied to PGC_allocated.
However, these pages are actually owned by dom_cow, resulting both sharing and
unsharing breaking.

Signed-off-by: Tamas K Lengyel <tamas@tklengyel.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/mm/mem_sharing.c

index 03aafa57a68027c1cb7645036666901f9674374f..f16a3f532443a9830ec18ad283b4437648b75b2a 100644 (file)
@@ -965,7 +965,7 @@ static int share_pages(struct domain *sd, gfn_t sgfn, shr_handle_t sh,
     }
 
     /* Acquire an extra reference, for the freeing below to be safe. */
-    if ( !get_page(cpage, cd) )
+    if ( !get_page(cpage, dom_cow) )
     {
         ret = -EOVERFLOW;
         mem_sharing_page_unlock(secondpg);
@@ -1171,7 +1171,7 @@ int __mem_sharing_unshare_page(struct domain *d,
         mem_sharing_page_unlock(page);
         if ( last_gfn )
         {
-            if ( !get_page(page, d) )
+            if ( !get_page(page, dom_cow) )
             {
                 put_gfn(d, gfn);
                 domain_crash(d);