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

[Xen-changelog] [xen stable-4.4] tools/libxl: Fix free() of wild pointer in libxl__initiate_device_remove()



commit d40bed867d9550afe3d6e7c369647905109ce831
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jun 18 19:04:14 2014 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed Jul 2 15:41:59 2014 +0100

    tools/libxl: Fix free() of wild pointer in libxl__initiate_device_remove()
    
    libxl__initiate_device_remove() had a preexisting error path issue where
    libxl_dominfo_dispose() could be called on a libxl_dominfo object before it
    had been initialised with libxl_dominfo_init().
    
    This was safe until c/s ab44401 added the pointer ssid_label, which point
    libxl_dominfo_dispose() free()s.
    
    Unconditionally initialise info in libxl__initiate_device_remove() before
    taking an error path which will free it.
    
    Coverity-ID: 1223212
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Wei Liu <wei.liu2@xxxxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    (cherry picked from commit ddb4aa5dfa13781e8f31ba20923c14c1a083ce83)
---
 tools/libxl/libxl_device.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index ba7d100..29ed547 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -775,6 +775,8 @@ void libxl__initiate_device_remove(libxl__egc *egc,
     uint32_t my_domid, domid = aodev->dev->domid;
     int rc = 0;
 
+    libxl_dominfo_init(&info);
+
     rc = libxl__get_domid(gc, &my_domid);
     if (rc) {
         LOG(ERROR, "unable to get my domid");
@@ -782,7 +784,6 @@ void libxl__initiate_device_remove(libxl__egc *egc,
     }
 
     if (my_domid == LIBXL_TOOLSTACK_DOMID) {
-        libxl_dominfo_init(&info);
         rc = libxl_domain_info(CTX, &info, domid);
         if (rc) {
             LOG(ERROR, "unable to get info for domain %d", domid);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
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®.