]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
gnttab: add missing version check to GNTTABOP_swap_grant_ref handling
authorJan Beulich <jbeulich@suse.com>
Thu, 11 Jun 2015 12:44:12 +0000 (14:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 11 Jun 2015 12:44:12 +0000 (14:44 +0200)
... avoiding NULL derefs when the version to use wasn't set yet (via
GNTTABOP_setup_table or GNTTABOP_set_version).

This is CVE-2015-4163 / XSA-134.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
xen/common/grant_table.c

index dfb45f8d6661fc60379abd29597bc23e55d674ff..ca4c9733787f98b2397fbccbc4f33d8f50af709e 100644 (file)
@@ -2592,6 +2592,9 @@ __gnttab_swap_grant_ref(grant_ref_t ref_a, grant_ref_t ref_b)
 
     spin_lock(&gt->lock);
 
+    if ( gt->gt_version == 0 )
+        PIN_FAIL(out, GNTST_general_error, "grant table not yet set up\n");
+
     /* Bounds check on the grant refs */
     if ( unlikely(ref_a >= nr_grant_entries(d->grant_table)))
         PIN_FAIL(out, GNTST_bad_gntref, "Bad ref-a (%d).\n", ref_a);