xen/gnttab: Fix error path in map_grant_ref()
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Tue, 14 Apr 2020 12:41:02 +0000 (14:41 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 14 Apr 2020 12:41:02 +0000 (14:41 +0200)
Part of XSA-295 (c/s 863e74eb2cffb) inadvertently re-positioned the brackets,
changing the logic.  If the _set_status() call fails, the grant_map hypercall
would fail with a status of 1 (rc != GNTST_okay) instead of the expected
negative GNTST_* error.

This error path can be taken due to bad guest state, and causes net/blk-back
in Linux to crash.

This is XSA-316.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
xen/common/grant_table.c

index 9fd6e604168248ae9edd7c1c47db7d5ac24e497c..4b5344dc21f57e44427d9b7ae9882c1ad10aaa6f 100644 (file)
@@ -1031,7 +1031,7 @@ map_grant_ref(
     {
         if ( (rc = _set_status(shah, status, rd, rgt->gt_version, act,
                                op->flags & GNTMAP_readonly, 1,
-                               ld->domain_id) != GNTST_okay) )
+                               ld->domain_id)) != GNTST_okay )
             goto act_release_out;
 
         if ( !act->pin )