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

[Xen-changelog] [xen master] libxc: fix unmap of ACPI guest memory region



commit 88f21a0c2a4c8d59cf25ba2d6e6f13d6ce5a42ae
Author:     Roger Pau Monne <roger.pau@xxxxxxxxxx>
AuthorDate: Tue Nov 8 17:22:15 2016 +0100
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Nov 11 01:10:10 2016 +0000

    libxc: fix unmap of ACPI guest memory region
    
    Commit fac7f7 changed the value of ptr so that it points to the right memory
    area, taking the page offset into account, but failed to remove this when
    doing the unmap, which caused the region to not be unmapped. Fix this by not
    modifying ptr and instead adding the page offset directly in the memcpy
    call.
    
    Coverity-ID: 1394285
    
    Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxc/xc_dom_core.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/tools/libxc/xc_dom_core.c b/tools/libxc/xc_dom_core.c
index ad819dd..36cd3c8 100644
--- a/tools/libxc/xc_dom_core.c
+++ b/tools/libxc/xc_dom_core.c
@@ -1119,10 +1119,9 @@ static int xc_dom_load_acpi(struct xc_dom_image *dom)
             goto err;
         }
 
-        ptr = (uint8_t *)ptr +
-              (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK);
-
-        memcpy(ptr, dom->acpi_modules[i].data, dom->acpi_modules[i].length);
+        memcpy((uint8_t *)ptr +
+               (dom->acpi_modules[i].guest_addr_out & ~XC_PAGE_MASK),
+               dom->acpi_modules[i].data, dom->acpi_modules[i].length);
         munmap(ptr, XC_PAGE_SIZE * num_pages);
 
         free(extents);
--
generated by git-patchbot for /home/xen/git/xen.git#master

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

 


Rackspace

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