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

[Xen-changelog] [xen stable-4.5] tools/libxc: Don't leave scratch_pfn uninitialised if the domain has no memory



commit 3665563ac10c5476484dc1c13776fd997c1592e5
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Wed Jan 28 15:52:35 2015 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Tue Mar 3 17:40:56 2015 +0000

    tools/libxc: Don't leave scratch_pfn uninitialised if the domain has no 
memory
    
    c/s 5b5c40c0d1 "libxc: introduce a per architecture scratch pfn for 
temporary
    grant mapping" accidentally an issue whereby there were two paths out of
    xc_core_arch_get_scratch_gpfn() which returned 0, but only one of which
    assigned a value to the gpfn parameter.
    
    xc_domain_maximum_gpfn() can validly return 0, at which point gpfn 1 is a
    valid scratch page to use.
    
    In addition, widen rc before adding 1 and possibly overflowing.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Julien Grall <julien.grall@xxxxxxxxxx>
    CC: Jan Beulich <JBeulich@xxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    CC: Wei Liu <wei.liu2@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    (cherry picked from commit 5b0447f647b1031595d24a8a50b362726c887d12)
---
 tools/libxc/xc_core_x86.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/libxc/xc_core_x86.c b/tools/libxc/xc_core_x86.c
index fac99ec..d8846f1 100644
--- a/tools/libxc/xc_core_x86.c
+++ b/tools/libxc/xc_core_x86.c
@@ -214,10 +214,10 @@ xc_core_arch_get_scratch_gpfn(xc_interface *xch, domid_t 
domid,
 
     rc = xc_domain_maximum_gpfn(xch, domid);
 
-    if ( rc <= 0 )
+    if ( rc < 0 )
         return rc;
 
-    *gpfn = rc + 1;
+    *gpfn = (xen_pfn_t)rc + 1;
 
     return 0;
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

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