From 1e213d5068a8b5f7ef00cc394bb71fb070e6df90 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 29 Apr 2016 19:10:45 +0100 Subject: [PATCH] libxl: Do not trust backend for disk in getinfo Do not read the frontend path out of the backend. We have it in our hand. Likewise the guest (frontend) domid was one of our parameters (!) This is part of XSA-178. Signed-off-by: Ian Jackson Reviewed-by: Wei Liu --- tools/libxl/libxl.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c index a62594d5dd..715ef49d2a 100644 --- a/tools/libxl/libxl.c +++ b/tools/libxl/libxl.c @@ -2440,9 +2440,8 @@ int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid, val = libxl__xs_read(gc, XBT_NULL, GCSPRINTF("%s/ring-ref", fe_path)); diskinfo->rref = val ? strtoul(val, NULL, 10) : -1; diskinfo->frontend = xs_read(ctx->xsh, XBT_NULL, - libxl__sprintf(gc, "%s/frontend", diskinfo->backend), NULL); - val = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend-id", diskinfo->backend)); - diskinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1; + GCSPRINTF("%s/frontend", libxl_path), NULL); + diskinfo->frontend_id = domid; GC_FREE; return 0; -- 2.39.5