From: Ian Jackson Date: Fri, 29 Apr 2016 18:15:13 +0000 (+0100) Subject: libxl: cdrom eject and insert: write to /libxl X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~1049 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3a5fec03793e0aa389f223d9a21d5a36a26f8b5f;p=xen.git libxl: cdrom eject and insert: write to /libxl Copy the new type and params values to /libxl, so that the information in /libxl is kept up to date. This is needed so that we can return this trustworthy information, rather than trusting the backend-writeable parts of xenstore. This is part of XSA-178. Signed-off-by: Ian Jackson Reviewed-by: Wei Liu --- diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index 1f9e26ebb5..944f848b2d 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2896,7 +2896,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, libxl_domain_config d_config; int rc, dm_ver; libxl__device device; - const char * path; + const char *path, *libxl_path; char * tmp; libxl__domain_userdata_lock *lock = NULL; xs_transaction_t t = XBT_NULL; @@ -2970,6 +2970,7 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, if (rc) goto out; path = libxl__device_backend_path(gc, &device); + libxl_path = libxl__device_libxl_path(gc, &device); insert = flexarray_make(gc, 4, 1); @@ -3018,8 +3019,12 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, goto out; } - rc = libxl__xs_writev(gc, t, path, - libxl__xs_kvs_of_flexarray(gc, empty, empty->count)); + char **kvs = libxl__xs_kvs_of_flexarray(gc, empty, empty->count); + + rc = libxl__xs_writev(gc, t, path, kvs); + if (rc) goto out; + + rc = libxl__xs_writev(gc, t, libxl_path, kvs); if (rc) goto out; rc = libxl__xs_transaction_commit(gc, &t); @@ -3056,8 +3061,12 @@ int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, rc = libxl__set_domain_configuration(gc, domid, &d_config); if (rc) goto out; - rc = libxl__xs_writev(gc, t, path, - libxl__xs_kvs_of_flexarray(gc, insert, insert->count)); + char **kvs = libxl__xs_kvs_of_flexarray(gc, insert, insert->count); + + rc = libxl__xs_writev(gc, t, path, kvs); + if (rc) goto out; + + rc = libxl__xs_writev(gc, t, libxl_path, kvs); if (rc) goto out; rc = libxl__xs_transaction_commit(gc, &t);