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

[Xen-changelog] [xen master] vmap: avoid hitting an ASSERT with vfree(NULL)



commit 640f891eb258563bb155e577389e8c5e6541a59a
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu May 21 08:57:19 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu May 21 08:57:19 2015 +0200

    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>
    Acked-by: Tim Deegan <tim@xxxxxxx>
---
 xen/common/vmap.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

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++ )
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

 


Rackspace

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