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

[Xen-devel] [PATCH] xen: fail gnttab_grow_table() in case of missing allocations



In case gnttab_grow_table() is being called without grant_table_init()
having been called for the domain, e.g. in case of a toolstack error,
fail the function instead of crashing the system.

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
 xen/common/grant_table.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c
index 71706f5cba..f2598a902f 100644
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1669,7 +1669,11 @@ gnttab_grow_table(struct domain *d, unsigned int 
req_nr_frames)
     struct grant_table *gt = d->grant_table;
     unsigned int i, j;
 
-    ASSERT(gt->active);
+    if ( unlikely(!gt->active) )
+    {
+        gdprintk(XENLOG_WARNING, "grant_table_set_limits() call missing.\n");
+        return 0;
+    }
 
     if ( req_nr_frames < INITIAL_NR_GRANT_FRAMES )
         req_nr_frames = INITIAL_NR_GRANT_FRAMES;
-- 
2.12.3


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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