defer the domain mapping in scrub_one_page()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 9 Dec 2013 13:13:23 +0000 (14:13 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Dec 2013 13:13:23 +0000 (14:13 +0100)
This avoids a resource leak and needless playing with the pagetables in the
case that the page is broken.

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

index 8002bd25177cfbe215df24aed993786bd9b6cfc9..5f484a2ecc7d13160ef8df0731dc4f032612f6c7 100644 (file)
@@ -1652,11 +1652,13 @@ __initcall(pagealloc_keyhandler_init);
 
 void scrub_one_page(struct page_info *pg)
 {
-    void *p = __map_domain_page(pg);
+    void *p;
 
     if ( unlikely(pg->count_info & PGC_broken) )
         return;
 
+    p = __map_domain_page(pg);
+
 #ifndef NDEBUG
     /* Avoid callers relying on allocations returning zeroed pages. */
     memset(p, 0xc2, PAGE_SIZE);