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

[Xen-devel] [PATCH] xen/vmap: Avoid hitting an ASSERT with vfree(NULL)



and unconditionally defer the vm_size() call, as it doesn't have a NULL short 
circuit.

Reported-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Tested-by: Wei Liu <wei.liu2@xxxxxxxxxx>
Reviewed-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>
CC: Keir Fraser <keir@xxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Tim Deegan <tim@xxxxxxx>
---
 xen/common/vmap.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/xen/common/vmap.c b/xen/common/vmap.c
index 8752595..ac66a8c 100644
--- a/xen/common/vmap.c
+++ b/xen/common/vmap.c
@@ -268,10 +268,14 @@ void *vzalloc(size_t size)
 
 void vfree(void *va)
 {
-    unsigned int i, pages = vm_size(va);
+    unsigned int i, pages;
     struct page_info *pg;
     PAGE_LIST_HEAD(pg_list);
 
+    if ( !va )
+        return;
+
+    pages = vm_size(va);
     ASSERT(pages);
 
     for ( i = 0; i < pages; i++ )
-- 
1.7.10.4


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

 


Rackspace

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