]> xenbits.xensource.com Git - xen.git/commitdiff
gnttab: never create host mapping unless asked to
authorJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 14:58:35 +0000 (16:58 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 20 Jun 2017 14:58:35 +0000 (16:58 +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>
master commit: 56f2ab5b970f1b18cf2019df4bf27db544cda6ea
master date: 2017-06-20 14:46:01 +0200

xen/common/grant_table.c

index b7bfd4d9282f980dca8248a82b3394329bde0901..39ee480bd7598e420e2bbbb18cb79fee4dc96d1c 100644 (file)
@@ -736,10 +736,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 )
     {