[xen stable-4.6] libxc: fix segfault on uninitialized xch->fmem

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.6] libxc: fix segfault on uninitialized xch->fmem

patchbot
commit 24f5900a0877e4370cef6b9189a964a7a156aadb
Author:     Seraphime Kirkovski <[hidden email]>
AuthorDate: Tue Apr 4 14:40:48 2017 +0200
Commit:     Ian Jackson <[hidden email]>
CommitDate: Tue May 16 15:42:51 2017 +0100

    libxc: fix segfault on uninitialized xch->fmem
   
    Currently in xc_interface_open, xch->fmem is not initialized
    and in some rare case the code fails before ever assigning a value
    to it.
   
    I got this in master:
   
       $ sudo ./xl/xl run
       xencall: error: Could not obtain handle on privileged command interface: No such file or directory
       Segmentation fault
   
    This initializes the whole xch_buff to 0.
   
    Signed-off-by: Seraphime Kirkovski <[hidden email]>
    Acked-by: Wei Liu <[hidden email]>
    (cherry picked from commit c4bdbec00c9063736361124a3492ebceabfaed06)
    (cherry picked from commit efd2ff999df72ee4c246927fd4297e3a75cadbf3)
    (cherry picked from commit 6a689975c69a38eb53c3de0b533a3d985dc8431d)
---
 tools/libxc/xc_private.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_private.c b/tools/libxc/xc_private.c
index 7c39897..dba673e 100644
--- a/tools/libxc/xc_private.c
+++ b/tools/libxc/xc_private.c
@@ -131,7 +131,7 @@ static struct xc_interface_core *xc_interface_open_common(xentoollog_logger *log
                                                           unsigned open_flags,
                                                           enum xc_osdep_type type)
 {
-    struct xc_interface_core xch_buf, *xch = &xch_buf;
+    struct xc_interface_core xch_buf = { 0 }, *xch = &xch_buf;
 
     xch->type = type;
     xch->flags = open_flags;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.6

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog