$NetBSD: patch-CVE-2015-4163,v 1.1 2015/08/23 16:17:12 spz Exp $

patch for CVE-2015-4163 aka XSA-134 from
http://xenbits.xen.org/xsa/xsa134.patch

--- xen/common/grant_table.c.orig	2014-09-02 06:22:57.000000000 +0000
+++ xen/common/grant_table.c
@@ -2372,6 +2372,9 @@ __gnttab_swap_grant_ref(grant_ref_t ref_
 
     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);
