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

[Xen-changelog] [xen stable-4.5] ocaml/xenctrl: Check return values from hypercalls



commit c91ed889ea3c3781a94a30909f30c3aad56c97d5
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jan 27 20:38:11 2015 +0000
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Wed May 27 17:03:36 2015 +0100

    ocaml/xenctrl: Check return values from hypercalls
    
    rather than blindly continuing and possibly using negative values.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    CC: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
    CC: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
    CC: Wei Liu <wei.liu2@xxxxxxxxxx>
    CC: Dave Scott <dave.scott@xxxxxxxxxxxxx>
    Acked-by: David Scott <dave.scott@xxxxxxxxxx>
    (cherry picked from commit 3380f5b6270e6fa4b24313f8808e7625e4c5a6ba)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index f0810eb..92d064f 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -457,6 +457,9 @@ CAMLprim value stub_xc_vcpu_getaffinity(value xch, value 
domid,
        int i, len = xc_get_max_cpus(_H(xch));
        int retval;
 
+       if (len < 1)
+               failwith_xc(_H(xch));
+
        c_cpumap = xc_cpumap_alloc(_H(xch));
        if (c_cpumap == NULL)
                failwith_xc(_H(xch));
@@ -821,6 +824,12 @@ CAMLprim value stub_xc_version_version(value xch)
 
        caml_enter_blocking_section();
        packed = xc_version(_H(xch), XENVER_version, NULL);
+       caml_leave_blocking_section();
+
+       if (packed < 0)
+               failwith_xc(_H(xch));
+
+       caml_enter_blocking_section();
        retval = xc_version(_H(xch), XENVER_extraversion, &extra);
        caml_leave_blocking_section();
 
--
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®.