[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] gnttab_setup_table error case



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.