]> xenbits.xensource.com Git - xen.git/commitdiff
gnttab: never create host mapping unless asked to
authorJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 12:46:01 +0000 (14:46 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 12:46:01 +0000 (14:46 +0200)
We shouldn't create a host mapping unless asked to even in the case of
mapping a granted MMIO page. In particular the mapping wouldn't be torn
down when processing the matching unmap request.

This is part of XSA-224.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
xen/common/grant_table.c

index c143e21afdd6ee65f07d4c9838bdff676283bb16..672582faad77ba244171451565357332f77991c2 100644 (file)
@@ -911,10 +911,13 @@ __gnttab_map_grant_ref(
             goto undo_out;
         }
 
-        rc = create_grant_host_mapping(
-            op->host_addr, frame, op->flags, cache_flags);
-        if ( rc != GNTST_okay )
-            goto undo_out;
+        if ( op->flags & GNTMAP_host_map )
+        {
+            rc = create_grant_host_mapping(op->host_addr, frame, op->flags,
+                                           cache_flags);
+            if ( rc != GNTST_okay )
+                goto undo_out;
+        }
     }
     else if ( owner == rd || owner == dom_cow )
     {