WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] gnttab_setup_table error case

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] gnttab_setup_table error case
From: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Date: Wed, 30 Jul 2008 14:17:39 +0100
Delivery-date: Wed, 30 Jul 2008 06:18:21 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)
gnttab_setup_table should set an error status code if the gmfn it gets
for a grant table page is invalid.

I ran into this issue when I tried to set up the grant table during hvm
domain creation, and it caused a BUG_ON later down the line. With this
patch, the hypercall will gracefully fail instead.

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
---
diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -913,8 +913,15 @@ gnttab_setup_table(
     op.status = GNTST_okay;
     for ( i = 0; i < op.nr_frames; i++ )
     {
         gmfn = gnttab_shared_gmfn(d, d->grant_table, i);
+        if ( gmfn == -1 )
+        {
+            gdprintk(XENLOG_INFO,
+                    "grant table gmfn unavailable\n");
+            op.status = GNTST_general_error;
+            goto out3;
+        }
         (void)copy_to_guest_offset(op.frame_list, i, &gmfn, 1);
     }
 
  out3:

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>